From cppreference.com
classweekday_indexed;(since C++20)The class weekday_indexed combines a
, representing a day of the week in the
, with a small index n in the range [1, 5]. It represents the first, second, third, fourth, or fifth weekday of some month.
weekday_indexed is a
.
Member functions
Nonmember functions
Helper classes
Example
Run this code
#include<chrono>#include<iostream>intmain(){usingnamespacestd::chrono;constexprweekday_indexedwi=Friday[2];// Indexed weekday can be used at any place where chrono::day can be used:constexpryear_month_weekdayymwd=2021y/August/wi;static_assert(ymwd==August/wi/2021y&&ymwd==wi/August/2021y);std::cout<<ymwd<<'\n';constexpryear_month_dayymd{ymwd};// a conversionstatic_assert(ymd==2021y/8/13);std::cout<<ymd<<'\n';}Possible output:
2021/Aug/Fri[2] 2021-08-13