[time.cal.mwd]

# 30 Time library [[time]](./#time)

## 30.8 The civil calendar [[time.cal]](time.cal#mwd)

### 30.8.11 Class month_weekday [time.cal.mwd]

#### [30.8.11.1](#overview) Overview [[time.cal.mwd.overview]](time.cal.mwd.overview)

namespace std::chrono {class month_weekday { chrono::month m_; // *exposition only* chrono::weekday_indexed wdi_; // *exposition only*public:constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr bool ok() const noexcept; };}

[1](#overview-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5774)

month_weekday represents the nth weekday of a month,
of an as yet unspecified year[.](#overview-1.sentence-1)

To do this the month_weekday stores a month and a weekday_indexed[.](#overview-1.sentence-2)

[2](#overview-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5779)

[*Example [1](#overview-example-1)*: constexpr auto mwd = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_indexed() == Tuesday[3]); â *end example*]

[3](#overview-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5789)

month_weekday is a trivially copyable and standard-layout class type[.](#overview-3.sentence-1)

#### [30.8.11.2](#members) Member functions [[time.cal.mwd.members]](time.cal.mwd.members)

[ð](#lib:month_weekday,constructor)

`constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept;
`

[1](#members-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5800)

*Effects*: Initializes m_ with m, and wdi_ with wdi[.](#members-1.sentence-1)

[ð](#lib:month,month_weekday)

`constexpr chrono::month month() const noexcept;
`

[2](#members-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5811)

*Returns*: m_[.](#members-2.sentence-1)

[ð](#lib:weekday_indexed,month_weekday)

`constexpr chrono::weekday_indexed weekday_indexed() const noexcept;
`

[3](#members-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5822)

*Returns*: wdi_[.](#members-3.sentence-1)

[ð](#lib:ok,month_weekday)

`constexpr bool ok() const noexcept;
`

[4](#members-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5833)

*Returns*: m_.ok() && wdi_.ok()[.](#members-4.sentence-1)

#### [30.8.11.3](#nonmembers) Non-member functions [[time.cal.mwd.nonmembers]](time.cal.mwd.nonmembers)

[ð](#lib:operator==,month_weekday)

`constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept;
`

[1](#nonmembers-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5846)

*Returns*: x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()[.](#nonmembers-1.sentence-1)

[ð](#lib:operator%3c%3c,month_weekday)

`template<class charT, class traits>
  basic_ostream<charT, traits>&
    operator<<(basic_ostream<charT, traits>& os, const month_weekday& mwd);
`

[2](#nonmembers-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5859)

*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}/{:L}"),
 mwd.month(), mwd.weekday_indexed());
