Namespaces
Variants
Actions

std::chrono::weekday

From cppreference.com
< cpp‎ | chrono
 
 
Date and time library
(C++11)
(C++20)
(C++11)
(C++11)
(C++11)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
weekday
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)(C++20)
(C++20)

 
 
Defined in header <chrono>
class weekday;
(since C++20)
inline constexpr std::chrono::weekday Sunday{0};
(since C++20)
inline constexpr std::chrono::weekday Monday{1};
(since C++20)
inline constexpr std::chrono::weekday Tuesday{2};
(since C++20)
inline constexpr std::chrono::weekday Wednesday{3};
(since C++20)
inline constexpr std::chrono::weekday Thursday{4};
(since C++20)
inline constexpr std::chrono::weekday Friday{5};
(since C++20)
inline constexpr std::chrono::weekday Saturday{6};
(since C++20)

The class weekday represent a day of the week in the proleptic Gregorian calendar. Its normal range is [06], for Sunday through Saturday, but it can hold any value in the range [0255]. Seven named constants are predefined in the std::chrono namespace for the seven days of the week.

weekday is a TriviallyCopyable StandardLayoutType.

[edit] Member functions

constructs a weekday
(public member function) [edit]
increments or decrements the weekday
(public member function) [edit]
adds or subtracts a number of days
(public member function) [edit]
retrieves the stored weekday value
retrieves ISO 8601 weekday value
(public member function) [edit]
checks if the stored weekday value is valid
(public member function) [edit]
convenience syntax for constructing a weekday_indexed or weekday_last from this weekday
(public member function) [edit]

[edit] Nonmember functions

(C++20)
compares two weekday values
(function) [edit]
performs arithmetic on weekdays
(function) [edit]
(C++20)
outputs a weekday into a stream
(function template) [edit]
(C++20)
parses a weekday from a stream according to the provided format
(function template) [edit]

[edit] Helper classes

formatting support for weekday
(class template specialization) [edit]
hash support for std::chrono::weekday
(class template specialization)

[edit] Example

Run this code
#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
Fri

[edit] See also

represents the nth weekday of a month
(class) [edit]
Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/chrono/weekday&oldid=157857"

AltStyle によって変換されたページ (->オリジナル) /