Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 1.25 KB

File metadata and controls

59 lines (47 loc) · 1.25 KB

weekday

  • chrono[meta header]
  • std::chrono[meta namespace]
  • year_month_weekday_last[meta class]
  • function[meta id-type]
  • cpp20[meta cpp]
constexpr chrono::weekday weekday() const noexcept; // (1) C++20
  • chrono::weekday[link /reference/chrono/weekday.md]

概要

曜日要素を取得する。

戻り値

以下と等価:

return weekday_last().weekday();
  • weekday_last()[link weekday_last.md]
  • weekday()[link /reference/chrono/weekday_last/weekday.md]

#include <cassert>
#include <chrono>

namespace chrono = std::chrono;
using namespace std::chrono_literals;

int main()
{
  chrono::year_month_weekday_last date = 2020y/3/chrono::Sunday[chrono::last];
  chrono::weekday wd = date.weekday();
  assert(wd == chrono::Sunday);
}
  • date.weekday()[color ff0000]
  • chrono::weekday[link /reference/chrono/weekday.md]
  • 2020y[link /reference/chrono/year/op_y.md]
  • chrono::Sunday[link /reference/chrono/weekday_constants.md]
  • chrono::last[link /reference/chrono/last_spec.md]

出力

バージョン

言語

  • C++20

処理系