[time.cal.mdlast]

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

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

### 30.8.10 Class month_day_last [time.cal.mdlast]

namespace std::chrono {class month_day_last { chrono::month m_; // *exposition only*public:constexpr explicit month_day_last(const chrono::month& m) noexcept; constexpr chrono::month month() const noexcept; constexpr bool ok() const noexcept; };}

[1](#1)

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

month_day_last represents the last day of a month[.](#1.sentence-1)

[2](#2)

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

[*Note [1](#note-1)*:

A month_day_last object
can be constructed using the expression m/last or last/m,
where m is an expression of type month[.](#2.sentence-1)

â *end note*]

[*Example [1](#example-1)*: constexpr auto mdl = February/last; // mdl is the last day of February of an as yet unspecified yearstatic_assert(mdl.month() == February); â *end example*]

[3](#3)

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

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

[ð](#lib:month_day_last,constructor)

`constexpr explicit month_day_last(const chrono::month& m) noexcept;
`

[4](#4)

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

*Effects*: Initializes m_ with m[.](#4.sentence-1)

[ð](#lib:month,month_day_last)

`constexpr month month() const noexcept;
`

[5](#5)

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

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

[ð](#lib:ok,month_day_last)

`constexpr bool ok() const noexcept;
`

[6](#6)

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

*Returns*: m_.ok()[.](#6.sentence-1)

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

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

[7](#7)

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

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

[ð](#lib:operator%3c=%3e,month_day_last)

`constexpr strong_ordering operator<=>(const month_day_last& x, const month_day_last& y) noexcept;
`

[8](#8)

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

*Returns*: x.month() <=> y.month()[.](#8.sentence-1)

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

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

[9](#9)

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

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