[time.cal.ym.members]

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

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

### 30.8.13 Class year_month [[time.cal.ym]](time.cal.ym#members)

#### 30.8.13.2 Member functions [time.cal.ym.members]

[ð](#lib:year_month,constructor)

`constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept;
`

[1](#1)

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

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

[ð](#lib:year,year_month)

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

[2](#2)

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

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

[ð](#lib:month,year_month)

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

[3](#3)

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

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

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

`constexpr year_month& operator+=(const months& dm) noexcept;
`

[4](#4)

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

*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"))[.](#4.sentence-1)

[5](#5)

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

*Effects*: *this = *this + dm[.](#5.sentence-1)

[6](#6)

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

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

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

`constexpr year_month& operator-=(const months& dm) noexcept;
`

[7](#7)

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

*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"))[.](#7.sentence-1)

[8](#8)

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

*Effects*: *this = *this - dm[.](#8.sentence-1)

[9](#9)

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

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

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

`constexpr year_month& operator+=(const years& dy) noexcept;
`

[10](#10)

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

*Effects*: *this = *this + dy[.](#10.sentence-1)

[11](#11)

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

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

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

`constexpr year_month& operator-=(const years& dy) noexcept;
`

[12](#12)

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

*Effects*: *this = *this - dy[.](#12.sentence-1)

[13](#13)

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

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

[ð](#lib:ok,year_month)

`constexpr bool ok() const noexcept;
`

[14](#14)

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

*Returns*: y_.ok() && m_.ok()[.](#14.sentence-1)
