Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::chrono::weekday

      From cppreference.com
      <cpp‎ |chrono
       
       
      Date and time library
       
       
      Defined in header<chrono>
      class weekday;
      (since C++20)
      inlineconstexpr std::chrono::weekday Sunday{0};
      (since C++20)
      inlineconstexpr std::chrono::weekday Monday{1};
      (since C++20)
      inlineconstexpr std::chrono::weekday Tuesday{2};
      (since C++20)
      inlineconstexpr std::chrono::weekday Wednesday{3};
      (since C++20)
      inlineconstexpr std::chrono::weekday Thursday{4};
      (since C++20)
      inlineconstexpr std::chrono::weekday Friday{5};
      (since C++20)
      inlineconstexpr std::chrono::weekday Saturday{6};
      (since C++20)

      The classweekday represent a day of the week in theproleptic 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 thestd::chrono namespace for the seven days of the week.

      weekday is aTriviallyCopyableStandardLayoutType.

      Contents

      [edit]Member functions

      constructs aweekday
      (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 aweekday_indexed orweekday_last from thisweekday
      (public member function)[edit]

      [edit]Nonmember functions

      (C++20)
      compares twoweekday values
      (function)[edit]
      performs arithmetic onweekdays
      (function)[edit]
      (C++20)
      outputs aweekday into a stream
      (function template)[edit]
      parses aweekday from a stream according to the provided format
      (function template)[edit]

      [edit]Helper classes

      formatting support forweekday
      (class template specialization)[edit]
      hash support forstd::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:

      WedThuFri

      [edit]See also

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

      [8]ページ先頭

      ©2009-2025 Movatter.jp