year_month_weekday_last

year_month_weekday_last (해·월·마지막 n요일)

특정 해·월의 "마지막 무슨 요일"을 나타내는 타입이에요. <chrono> 헤더, C++20부터.

출처: cppreference

본문

std::chrono::year_month_weekday_last는 특정 해·월의 마지막 특정 요일을 나타내요.

class year_month_weekday_last;
  • year(), month(), weekday_last() 멤버 제공.
  • ok(): 유효한지.
  • operator/로 생성: 2023y / November / Thursday[last] (2023년 11월 마지막 목요일).
using namespace std::chrono;
auto ymwdl = 2023y / November / Thursday[last];
  • sys_days로 변환하면 실제 날짜가 계산돼요.

"특정 월의 마지막 n요일" 규칙 날짜(예: 미국 추수감사절 = 11월 마지막 목요일)를 표현하고 실제 날짜를 계산할 때 유용해요.

더 알아보기 (Learn more)

cppreference