On this page
std::chrono::weekday
| Defined in header <chrono> | ||
|---|---|---|
|  | (since C++20) | |
|  | (since C++20) | |
|  | (since C++20) | |
|  | (since C++20) | |
|  | (since C++20) | |
|  | (since C++20) | |
|  | (since C++20) | |
|  | (since C++20) | 
The class weekday represent a day of the week in the proleptic Gregorian calendar. Its normal range is [0, 6], for Sunday through Saturday, but it can hold any value in the range [0, 255]. Seven named constants are predefined in the std::chrono namespace for the seven days of the week.
weekday is a TriviallyCopyable StandardLayoutType.
Member functions
| constructs a weekday(public member function) | |
| increments or decrements the weekday (public member function) | |
| adds or subtracts a number of days (public member function) | |
| retrieves the stored weekday value retrieves ISO 8601 weekday value (public member function) | |
| checks if the stored weekday value is valid (public member function) | |
| convenience syntax for constructing a weekday_indexedorweekday_lastfrom thisweekday(public member function) | 
Nonmember functions
| (C++20)
        | compares two weekdayvalues(function) | 
| (C++20)
        | performs arithmetic on weekdays(function) | 
| (C++20)
        | outputs a weekdayinto a stream(function template) | 
| (C++20)
        | parses a weekdayfrom a stream according to the provided format(function template) | 
Helper classes
| (C++20)
        | formatting support for weekday(class template specialization) | 
| (C++26)
        | hash support for std::chrono::weekday(class template specialization) | 
Example
#include <chrono>
#include <iostream>
 
int main()
{
    std::chrono::weekday x{42 / 13};
    std::cout << x++ << '\n';
    std::cout << x << '\n';
    std::cout << ++x << '\n';
}Output:
Wed
Thu
FriSee also
| (C++20)
        | represents the nth weekdayof a month(class) | 
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
 https://en.cppreference.com/w/cpp/chrono/weekday