[time.cal.ymwd.members]

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

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

### 30.8.16 Class year_month_weekday [[time.cal.ymwd]](time.cal.ymwd#members)

#### 30.8.16.2 Member functions [time.cal.ymwd.members]

[ð](#lib:year_month_weekday,constructor)

`constexpr year_month_weekday(const chrono::year& y, const chrono::month& m,
                             const chrono::weekday_indexed& wdi) noexcept;
`

[1](#1)

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

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

[ð](#lib:year_month_weekday,constructor_)

`constexpr year_month_weekday(const sys_days& dp) noexcept;
`

[2](#2)

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

*Effects*: Constructs an object of type year_month_weekday which corresponds to the date represented by dp[.](#2.sentence-1)

[3](#3)

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

*Remarks*: For any value ymwd of type year_month_weekday for which ymwd.ok() is true,ymwd == year_month_weekday{sys_days{ymwd}} is true[.](#3.sentence-1)

[ð](#lib:year_month_weekday,constructor__)

`constexpr explicit year_month_weekday(const local_days& dp) noexcept;
`

[4](#4)

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

*Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#4.sentence-1)

[ð](#lib:operator+=,year_month_weekday)

`constexpr year_month_weekday& operator+=(const months& m) noexcept;
`

[5](#5)

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

*Constraints*: If the argument supplied by the caller for the months parameter
is convertible to years,
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#5.sentence-1)

[6](#6)

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

*Effects*: *this = *this + m[.](#6.sentence-1)

[7](#7)

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

*Returns*: *this[.](#7.sentence-1)

[ð](#lib:operator-=,year_month_weekday)

`constexpr year_month_weekday& operator-=(const months& m) noexcept;
`

[8](#8)

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

*Constraints*: If the argument supplied by the caller for the months parameter
is convertible to years,
its implicit conversion sequence to years is worse than its implicit conversion sequence tomonths ([[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"))[.](#8.sentence-1)

[9](#9)

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

*Effects*: *this = *this - m[.](#9.sentence-1)

[10](#10)

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

*Returns*: *this[.](#10.sentence-1)

[ð](#lib:operator+=,year_month_weekday_)

`constexpr year_month_weekday& operator+=(const years& y) noexcept;
`

[11](#11)

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

*Effects*: *this = *this + y[.](#11.sentence-1)

[12](#12)

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

*Returns*: *this[.](#12.sentence-1)

[ð](#lib:operator-=,year_month_weekday_)

`constexpr year_month_weekday& operator-=(const years& y) noexcept;
`

[13](#13)

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

*Effects*: *this = *this - y[.](#13.sentence-1)

[14](#14)

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

*Returns*: *this[.](#14.sentence-1)

[ð](#lib:year,year_month_weekday)

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

[15](#15)

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

*Returns*: y_[.](#15.sentence-1)

[ð](#lib:month,year_month_weekday)

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

[16](#16)

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

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

[ð](#lib:weekday,year_month_weekday)

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

[17](#17)

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

*Returns*: wdi_.weekday()[.](#17.sentence-1)

[ð](#lib:index,year_month_weekday)

`constexpr unsigned index() const noexcept;
`

[18](#18)

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

*Returns*: wdi_.index()[.](#18.sentence-1)

[ð](#lib:weekday_indexed,year_month_weekday)

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

[19](#19)

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

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

[ð](#lib:operator_sys_days,year_month_weekday)

`constexpr operator sys_days() const noexcept;
`

[20](#20)

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

*Returns*: If y_.ok() && m_.ok() && wdi_.weekday().ok(),
returns a sys_days that
represents the date (index() - 1) * 7 days after
the first weekday() of year()/month()[.](#20.sentence-1)

If index() is 0
the returned sys_days represents the date 7 days prior to
the first weekday() of year()/month()[.](#20.sentence-2)

Otherwise the returned value is unspecified[.](#20.sentence-3)

[ð](#lib:operator_local_days,year_month_weekday)

`constexpr explicit operator local_days() const noexcept;
`

[21](#21)

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

*Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#21.sentence-1)

[ð](#lib:ok,year_month_weekday)

`constexpr bool ok() const noexcept;
`

[22](#22)

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

*Returns*: If any ofy_.ok(),m_.ok(), orwdi_.ok() is false, returns false[.](#22.sentence-1)

Otherwise, if *this represents a valid date,
returns true[.](#22.sentence-2)

Otherwise, returns false[.](#22.sentence-3)
