std::chrono::weekday::weekday - cppreference.com (original) (raw)

weekday() = default; (1) (since C++20)
constexpr explicit weekday( unsigned wd ) noexcept; (2) (since C++20)
constexpr weekday( const std::chrono::sys_days& sd ) noexcept; (3) (since C++20)
constexpr explicit weekday( const std::chrono::local_days& ld ) noexcept; (4) (since C++20)

Constructs a weekday object.

  1. Default constructor leaves the weekday value uninitialized.

  2. Constructs a weekday object holding the weekday value wd. If wd == 7, the value held is ​0​. If wd > 255, the value held is unspecified.

  3. Constructs a weekday object representing the day of the week sd corresponds to. This constructor defines an implicit conversion from std::chrono::sys_days to weekday.

  4. Constructs a weekday object representing the day of the week ld corresponds to, as if by weekday(std::chrono::sys_days(ld.time_since_epoch())).

[edit] Parameters

wd - a weekday value
sd - a system days object
ld - a local days object

[edit] Example

Output:

2020-03-13 is Fri 2020-11-13 is Fri 2021-08-13 is Fri 2022-05-13 is Fri 2023-01-13 is Fri 2023-10-13 is Fri 2024-09-13 is Fri 2024-12-13 is Fri