• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <chrono>

    std::chrono::year_month::month

    constexpr chrono::month month() const noexcept; // (1) C++20
    

    概要

    月要素を取得する。

    戻り値

    コンストラクタで設定されて保持している月オブジェクトを返す。

    #include <cassert>
    #include <chrono>
    
    namespace chrono = std::chrono;
    using namespace std::chrono_literals;
    
    int main()
    {
      chrono::year_month date = 2020y/3;
      chrono::month m = date.month();
      assert(m == chrono::March);
    }
    

    出力

    バージョン

    言語

    • C++20

    処理系