weekday_indexed
from *this
and index
. The result represents the index
-th weekday in some yet-to-be-specified month. If index
is not in the range [1, 5] or if !ok()
the values held in the result is unspecified.weekday_last
from *this
. The result represents the last weekday in some yet-to-be-specified month.std::chrono::weekday_indexed(*this, index)
std::chrono::weekday_last(*this)
#include <chrono> #include <iostream> using namespace std::chrono; int main() { // second tuesday in October 2019 std::cout << year_month_day{ Tuesday[2] / October / 2019y } << '\n' // last tuesday in October 2019 << year_month_day{ Tuesday[last] / October / 2019y } << '\n'; }
Output:
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/chrono/weekday/operator_at