[time.cal.wdlast]

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

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

### 30.8.8 Class weekday_last [time.cal.wdlast]

#### [30.8.8.1](#overview) Overview [[time.cal.wdlast.overview]](time.cal.wdlast.overview)

namespace std::chrono {class weekday_last { chrono::weekday wd_; // *exposition only*public:constexpr explicit weekday_last(const chrono::weekday& wd) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr bool ok() const noexcept; };}

[1](#overview-1)

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

weekday_last represents the last weekday of a month[.](#overview-1.sentence-1)

[2](#overview-2)

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

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

A weekday_last object
can be constructed by indexing a weekday with last[.](#overview-2.sentence-1)

â *end note*]

[*Example [1](#overview-example-1)*: constexpr auto wdl = Sunday[last]; // wdl is the last Sunday of an as yet unspecified monthstatic_assert(wdl.weekday() == Sunday); â *end example*]

[3](#overview-3)

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

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

#### [30.8.8.2](#members) Member functions [[time.cal.wdlast.members]](time.cal.wdlast.members)

[ð](#lib:weekday_last,constructor)

`constexpr explicit weekday_last(const chrono::weekday& wd) noexcept;
`

[1](#members-1)

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

*Effects*: Initializes wd_ with wd[.](#members-1.sentence-1)

[ð](#lib:weekday_last,weekday)

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

[2](#members-2)

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

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

[ð](#lib:ok,weekday_last)

`constexpr bool ok() const noexcept;
`

[3](#members-3)

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

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

#### [30.8.8.3](#nonmembers) Non-member functions [[time.cal.wdlast.nonmembers]](time.cal.wdlast.nonmembers)

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

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

[1](#nonmembers-1)

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

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

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

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

[2](#nonmembers-2)

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

*Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*<charT>("{:L}[last]"), wdl.weekday());
