[time.cal] # 30 Time library [[time]](./#time) ## 30.8 The civil calendar [time.cal] ### [30.8.1](#general) General [[time.cal.general]](time.cal.general) [1](#general-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3918) The types in [time.cal] describe the civil (Gregorian) calendar and its relationship to sys_days and local_days[.](#general-1.sentence-1) ### [30.8.2](#last) Class last_spec [[time.cal.last]](time.cal.last) namespace std::chrono {struct last_spec {explicit last_spec() = default; };} [1](#last-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3933) The type last_spec is used in conjunction with other calendar types to specify the last in a sequence[.](#last-1.sentence-1) For example, depending on context, it can represent the last day of a month, or the last day of the week of a month[.](#last-1.sentence-2) ### [30.8.3](#day) Class day [[time.cal.day]](time.cal.day) #### [30.8.3.1](#day.overview) Overview [[time.cal.day.overview]](time.cal.day.overview) namespace std::chrono {class day {unsigned char d_; // *exposition only*public: day() = default; constexpr explicit day(unsigned d) noexcept; constexpr day& operator++() noexcept; constexpr day operator++(int) noexcept; constexpr day& operator--() noexcept; constexpr day operator--(int) noexcept; constexpr day& operator+=(const days& d) noexcept; constexpr day& operator-=(const days& d) noexcept; constexpr explicit operator unsigned() const noexcept; constexpr bool ok() const noexcept; };} [1](#day.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3968) day represents a day of a month[.](#day.overview-1.sentence-1) It normally holds values in the range 1 to 31, but may hold non-negative values outside this range[.](#day.overview-1.sentence-2) It can be constructed with any unsigned value, which will be subsequently truncated to fit into day's unspecified internal storage[.](#day.overview-1.sentence-3) day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements, and participates in basic arithmetic with days objects, which represent a difference between two day objects[.](#day.overview-1.sentence-4) [2](#day.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3979) day is a trivially copyable and standard-layout class type[.](#day.overview-2.sentence-1) #### [30.8.3.2](#day.members) Member functions [[time.cal.day.members]](time.cal.day.members) [🔗](#lib:day,constructor) `constexpr explicit day(unsigned d) noexcept; ` [1](#day.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L3990) *Effects*: Initializes d_ with d[.](#day.members-1.sentence-1) The value held is unspecified if d is not in the range [0, 255][.](#day.members-1.sentence-2) [🔗](#lib:operator++,day) `constexpr day& operator++() noexcept; ` [2](#day.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4002) *Effects*: ++d_[.](#day.members-2.sentence-1) [3](#day.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4006) *Returns*: *this[.](#day.members-3.sentence-1) [🔗](#lib:operator++,day_) `constexpr day operator++(int) noexcept; ` [4](#day.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4017) *Effects*: ++(*this)[.](#day.members-4.sentence-1) [5](#day.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4021) *Returns*: A copy of *this as it existed on entry to this member function[.](#day.members-5.sentence-1) [🔗](#lib:operator--,day) `constexpr day& operator--() noexcept; ` [6](#day.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4032) *Effects*: Equivalent to: --d_[.](#day.members-6.sentence-1) [7](#day.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4036) *Returns*: *this[.](#day.members-7.sentence-1) [🔗](#lib:operator--,day_) `constexpr day operator--(int) noexcept; ` [8](#day.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4047) *Effects*: --(*this)[.](#day.members-8.sentence-1) [9](#day.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4051) *Returns*: A copy of *this as it existed on entry to this member function[.](#day.members-9.sentence-1) [🔗](#lib:operator+=,day) `constexpr day& operator+=(const days& d) noexcept; ` [10](#day.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4062) *Effects*: *this = *this + d[.](#day.members-10.sentence-1) [11](#day.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4066) *Returns*: *this[.](#day.members-11.sentence-1) [🔗](#lib:operator-=,day) `constexpr day& operator-=(const days& d) noexcept; ` [12](#day.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4077) *Effects*: *this = *this - d[.](#day.members-12.sentence-1) [13](#day.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4081) *Returns*: *this[.](#day.members-13.sentence-1) [🔗](#lib:operator_unsigned,day) `constexpr explicit operator unsigned() const noexcept; ` [14](#day.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4092) *Returns*: d_[.](#day.members-14.sentence-1) [🔗](#lib:ok,day) `constexpr bool ok() const noexcept; ` [15](#day.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4103) *Returns*: 1 <= d_ && d_ <= 31[.](#day.members-15.sentence-1) #### [30.8.3.3](#day.nonmembers) Non-member functions [[time.cal.day.nonmembers]](time.cal.day.nonmembers) [🔗](#lib:operator==,day) `constexpr bool operator==(const day& x, const day& y) noexcept; ` [1](#day.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4116) *Returns*: unsigned{x} == unsigned{y}[.](#day.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,day) `constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept; ` [2](#day.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4127) *Returns*: unsigned{x} <=> unsigned{y}[.](#day.nonmembers-2.sentence-1) [🔗](#lib:operator+,day) `constexpr day operator+(const day& x, const days& y) noexcept; ` [3](#day.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4138) *Returns*: day(unsigned{x} + y.count())[.](#day.nonmembers-3.sentence-1) [🔗](#lib:operator+,day_) `constexpr day operator+(const days& x, const day& y) noexcept; ` [4](#day.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4149) *Returns*: y + x[.](#day.nonmembers-4.sentence-1) [🔗](#lib:operator-,day) `constexpr day operator-(const day& x, const days& y) noexcept; ` [5](#day.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4160) *Returns*: x + -y[.](#day.nonmembers-5.sentence-1) [🔗](#lib:operator-,day_) `constexpr days operator-(const day& x, const day& y) noexcept; ` [6](#day.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4171) *Returns*: days{int(unsigned{x}) - int(unsigned{y})}[.](#day.nonmembers-6.sentence-1) [🔗](#lib:operator%3c%3c,day) `template basic_ostream& operator<<(basic_ostream& os, const day& d); ` [7](#day.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4184) *Effects*: Equivalent to:return os << (d.ok() ? format(*STATICALLY-WIDEN*("{:%d}"), d) : format(*STATICALLY-WIDEN*("{:%d} is not a valid day"), d)); [🔗](#lib:from_stream,day) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, day& d, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [8](#day.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4204) *Effects*: Attempts to parse the input stream is into the day d using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#day.nonmembers-8.sentence-1) If the parse fails to decode a valid day,is.setstate(ios_base​::​failbit) is called andd is not modified[.](#day.nonmembers-8.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#day.nonmembers-8.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#day.nonmembers-8.sentence-4) [9](#day.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4218) *Returns*: is[.](#day.nonmembers-9.sentence-1) [🔗](#lib:operator%22%22d,day) `constexpr chrono::day operator""d(unsigned long long d) noexcept; ` [10](#day.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4229) *Returns*: day{static_cast(d)}[.](#day.nonmembers-10.sentence-1) ### [30.8.4](#month) Class month [[time.cal.month]](time.cal.month) #### [30.8.4.1](#month.overview) Overview [[time.cal.month.overview]](time.cal.month.overview) namespace std::chrono {class month {unsigned char m_; // *exposition only*public: month() = default; constexpr explicit month(unsigned m) noexcept; constexpr month& operator++() noexcept; constexpr month operator++(int) noexcept; constexpr month& operator--() noexcept; constexpr month operator--(int) noexcept; constexpr month& operator+=(const months& m) noexcept; constexpr month& operator-=(const months& m) noexcept; constexpr explicit operator unsigned() const noexcept; constexpr bool ok() const noexcept; };} [1](#month.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4261) month represents a month of a year[.](#month.overview-1.sentence-1) It normally holds values in the range 1 to 12, but may hold non-negative values outside this range[.](#month.overview-1.sentence-2) It can be constructed with any unsigned value, which will be subsequently truncated to fit into month's unspecified internal storage[.](#month.overview-1.sentence-3) month meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements, and participates in basic arithmetic with months objects, which represent a difference between two month objects[.](#month.overview-1.sentence-4) [2](#month.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4272) month is a trivially copyable and standard-layout class type[.](#month.overview-2.sentence-1) #### [30.8.4.2](#month.members) Member functions [[time.cal.month.members]](time.cal.month.members) [🔗](#lib:month,constructor) `constexpr explicit month(unsigned m) noexcept; ` [1](#month.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4283) *Effects*: Initializes m_ with m[.](#month.members-1.sentence-1) The value held is unspecified if m is not in the range [0, 255][.](#month.members-1.sentence-2) [🔗](#lib:operator++,month) `constexpr month& operator++() noexcept; ` [2](#month.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4295) *Effects*: *this += months{1}[.](#month.members-2.sentence-1) [3](#month.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4299) *Returns*: *this[.](#month.members-3.sentence-1) [🔗](#lib:operator++,month_) `constexpr month operator++(int) noexcept; ` [4](#month.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4310) *Effects*: ++(*this)[.](#month.members-4.sentence-1) [5](#month.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4314) *Returns*: A copy of *this as it existed on entry to this member function[.](#month.members-5.sentence-1) [🔗](#lib:operator--,month) `constexpr month& operator--() noexcept; ` [6](#month.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4325) *Effects*: *this -= months{1}[.](#month.members-6.sentence-1) [7](#month.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4329) *Returns*: *this[.](#month.members-7.sentence-1) [🔗](#lib:operator--,month_) `constexpr month operator--(int) noexcept; ` [8](#month.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4340) *Effects*: --(*this)[.](#month.members-8.sentence-1) [9](#month.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4344) *Returns*: A copy of *this as it existed on entry to this member function[.](#month.members-9.sentence-1) [🔗](#lib:operator+=,month) `constexpr month& operator+=(const months& m) noexcept; ` [10](#month.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4355) *Effects*: *this = *this + m[.](#month.members-10.sentence-1) [11](#month.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4359) *Returns*: *this[.](#month.members-11.sentence-1) [🔗](#lib:operator-=,month) `constexpr month& operator-=(const months& m) noexcept; ` [12](#month.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4370) *Effects*: *this = *this - m[.](#month.members-12.sentence-1) [13](#month.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4374) *Returns*: *this[.](#month.members-13.sentence-1) [🔗](#lib:operator_unsigned,month) `constexpr explicit operator unsigned() const noexcept; ` [14](#month.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4385) *Returns*: m_[.](#month.members-14.sentence-1) [🔗](#lib:ok,month) `constexpr bool ok() const noexcept; ` [15](#month.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4396) *Returns*: 1 <= m_ && m_ <= 12[.](#month.members-15.sentence-1) #### [30.8.4.3](#month.nonmembers) Non-member functions [[time.cal.month.nonmembers]](time.cal.month.nonmembers) [🔗](#lib:operator==,month) `constexpr bool operator==(const month& x, const month& y) noexcept; ` [1](#month.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4409) *Returns*: unsigned{x} == unsigned{y}[.](#month.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,month) `constexpr strong_ordering operator<=>(const month& x, const month& y) noexcept; ` [2](#month.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4420) *Returns*: unsigned{x} <=> unsigned{y}[.](#month.nonmembers-2.sentence-1) [🔗](#lib:operator+,month) `constexpr month operator+(const month& x, const months& y) noexcept; ` [3](#month.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4431) *Returns*: month{modulo(static_cast(unsigned{x}) + (y.count() - 1), 12) + 1} where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division[.](#month.nonmembers-3.sentence-1) [*Note [1](#month.nonmembers-note-1)*: Given a divisor of 12, Euclidean division truncates towards negative infinity and always produces a remainder in the range of [0, 11][.](#month.nonmembers-3.sentence-2) Assuming no overflow in the signed summation, this operation results in a month holding a value in the range [1, 12] even if !x.ok()[.](#month.nonmembers-3.sentence-3) — *end note*] [*Example [1](#month.nonmembers-example-1)*: February + months{11} == January[.](#month.nonmembers-3.sentence-4) — *end example*] [🔗](#lib:operator+,month_) `constexpr month operator+(const months& x, const month& y) noexcept; ` [4](#month.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4454) *Returns*: y + x[.](#month.nonmembers-4.sentence-1) [🔗](#lib:operator-,month) `constexpr month operator-(const month& x, const months& y) noexcept; ` [5](#month.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4465) *Returns*: x + -y[.](#month.nonmembers-5.sentence-1) [🔗](#lib:operator-,month_) `constexpr months operator-(const month& x, const month& y) noexcept; ` [6](#month.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4476) *Returns*: If x.ok() == true and y.ok() == true, returns a value m in the range [months{0}, months{11}] satisfying y + m == x[.](#month.nonmembers-6.sentence-1) Otherwise the value returned is unspecified[.](#month.nonmembers-6.sentence-2) [*Example [2](#month.nonmembers-example-2)*: January - February == months{11}[.](#month.nonmembers-6.sentence-3) — *end example*] [🔗](#lib:operator%3c%3c,month) `template basic_ostream& operator<<(basic_ostream& os, const month& m); ` [7](#month.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4497) *Effects*: Equivalent to:return os << (m.ok() ? format(os.getloc(), *STATICALLY-WIDEN*("{:L%b}"), m) : format(os.getloc(), *STATICALLY-WIDEN*("{} is not a valid month"), static_cast(m))); [🔗](#lib:from_stream,month) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, month& m, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [8](#month.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4518) *Effects*: Attempts to parse the input stream is into the month m using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#month.nonmembers-8.sentence-1) If the parse fails to decode a valid month,is.setstate(ios_base​::​failbit) is called andm is not modified[.](#month.nonmembers-8.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#month.nonmembers-8.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#month.nonmembers-8.sentence-4) [9](#month.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4532) *Returns*: is[.](#month.nonmembers-9.sentence-1) ### [30.8.5](#year) Class year [[time.cal.year]](time.cal.year) #### [30.8.5.1](#year.overview) Overview [[time.cal.year.overview]](time.cal.year.overview) namespace std::chrono {class year {short y_; // *exposition only*public: year() = default; constexpr explicit year(int y) noexcept; constexpr year& operator++() noexcept; constexpr year operator++(int) noexcept; constexpr year& operator--() noexcept; constexpr year operator--(int) noexcept; constexpr year& operator+=(const years& y) noexcept; constexpr year& operator-=(const years& y) noexcept; constexpr year operator+() const noexcept; constexpr year operator-() const noexcept; constexpr bool is_leap() const noexcept; constexpr explicit operator int() const noexcept; constexpr bool ok() const noexcept; static constexpr year min() noexcept; static constexpr year max() noexcept; };} [1](#year.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4572) year represents a year in the civil calendar[.](#year.overview-1.sentence-1) It can represent values in the range [min(), max()][.](#year.overview-1.sentence-2) It can be constructed with any int value, which will be subsequently truncated to fit into year's unspecified internal storage[.](#year.overview-1.sentence-3) year meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements, and participates in basic arithmetic with years objects, which represent a difference between two year objects[.](#year.overview-1.sentence-4) [2](#year.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4582) year is a trivially copyable and standard-layout class type[.](#year.overview-2.sentence-1) #### [30.8.5.2](#year.members) Member functions [[time.cal.year.members]](time.cal.year.members) [🔗](#lib:year,constructor) `constexpr explicit year(int y) noexcept; ` [1](#year.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4593) *Effects*: Initializes y_ with y[.](#year.members-1.sentence-1) The value held is unspecified if y is not in the range [-32767, 32767][.](#year.members-1.sentence-2) [🔗](#lib:operator++,year) `constexpr year& operator++() noexcept; ` [2](#year.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4605) *Effects*: ++y_[.](#year.members-2.sentence-1) [3](#year.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4609) *Returns*: *this[.](#year.members-3.sentence-1) [🔗](#lib:operator++,year_) `constexpr year operator++(int) noexcept; ` [4](#year.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4620) *Effects*: ++(*this)[.](#year.members-4.sentence-1) [5](#year.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4624) *Returns*: A copy of *this as it existed on entry to this member function[.](#year.members-5.sentence-1) [🔗](#lib:operator--,year) `constexpr year& operator--() noexcept; ` [6](#year.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4635) *Effects*: --y_[.](#year.members-6.sentence-1) [7](#year.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4639) *Returns*: *this[.](#year.members-7.sentence-1) [🔗](#lib:operator--,year_) `constexpr year operator--(int) noexcept; ` [8](#year.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4650) *Effects*: --(*this)[.](#year.members-8.sentence-1) [9](#year.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4654) *Returns*: A copy of *this as it existed on entry to this member function[.](#year.members-9.sentence-1) [🔗](#lib:operator+=,year) `constexpr year& operator+=(const years& y) noexcept; ` [10](#year.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4665) *Effects*: *this = *this + y[.](#year.members-10.sentence-1) [11](#year.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4669) *Returns*: *this[.](#year.members-11.sentence-1) [🔗](#lib:operator-=,year) `constexpr year& operator-=(const years& y) noexcept; ` [12](#year.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4680) *Effects*: *this = *this - y[.](#year.members-12.sentence-1) [13](#year.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4684) *Returns*: *this[.](#year.members-13.sentence-1) [🔗](#lib:operator+,year) `constexpr year operator+() const noexcept; ` [14](#year.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4695) *Returns*: *this[.](#year.members-14.sentence-1) [🔗](#lib:operator-,year) `constexpr year operator-() const noexcept; ` [15](#year.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4706) *Returns*: year{-y_}[.](#year.members-15.sentence-1) [🔗](#lib:is_leap,year) `constexpr bool is_leap() const noexcept; ` [16](#year.members-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4717) *Returns*: y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0)[.](#year.members-16.sentence-1) [🔗](#lib:operator_int,year) `constexpr explicit operator int() const noexcept; ` [17](#year.members-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4728) *Returns*: y_[.](#year.members-17.sentence-1) [🔗](#lib:ok,year) `constexpr bool ok() const noexcept; ` [18](#year.members-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4739) *Returns*: min().y_ <= y_ && y_ <= max().y_[.](#year.members-18.sentence-1) [🔗](#lib:min,year) `static constexpr year min() noexcept; ` [19](#year.members-19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4750) *Returns*: year{-32767}[.](#year.members-19.sentence-1) [🔗](#lib:max,year) `static constexpr year max() noexcept; ` [20](#year.members-20) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4761) *Returns*: year{32767}[.](#year.members-20.sentence-1) #### [30.8.5.3](#year.nonmembers) Non-member functions [[time.cal.year.nonmembers]](time.cal.year.nonmembers) [🔗](#lib:operator==,year) `constexpr bool operator==(const year& x, const year& y) noexcept; ` [1](#year.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4774) *Returns*: int{x} == int{y}[.](#year.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,year) `constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept; ` [2](#year.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4785) *Returns*: int{x} <=> int{y}[.](#year.nonmembers-2.sentence-1) [🔗](#lib:operator+,year_) `constexpr year operator+(const year& x, const years& y) noexcept; ` [3](#year.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4796) *Returns*: year{int{x} + static_cast(y.count())}[.](#year.nonmembers-3.sentence-1) [🔗](#lib:operator+,year__) `constexpr year operator+(const years& x, const year& y) noexcept; ` [4](#year.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4807) *Returns*: y + x[.](#year.nonmembers-4.sentence-1) [🔗](#lib:operator-,year_) `constexpr year operator-(const year& x, const years& y) noexcept; ` [5](#year.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4818) *Returns*: x + -y[.](#year.nonmembers-5.sentence-1) [🔗](#lib:operator-,year__) `constexpr years operator-(const year& x, const year& y) noexcept; ` [6](#year.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4829) *Returns*: years{int{x} - int{y}}[.](#year.nonmembers-6.sentence-1) [🔗](#lib:operator%3c%3c,year) `template basic_ostream& operator<<(basic_ostream& os, const year& y); ` [7](#year.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4842) *Effects*: Equivalent to:return os << (y.ok() ? format(*STATICALLY-WIDEN*("{:%Y}"), y) : format(*STATICALLY-WIDEN*("{:%Y} is not a valid year"), y)); [🔗](#lib:from_stream,year) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, year& y, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [8](#year.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4862) *Effects*: Attempts to parse the input stream is into the year y using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#year.nonmembers-8.sentence-1) If the parse fails to decode a valid year,is.setstate(ios_base​::​failbit) is called andy is not modified[.](#year.nonmembers-8.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#year.nonmembers-8.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#year.nonmembers-8.sentence-4) [9](#year.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4876) *Returns*: is[.](#year.nonmembers-9.sentence-1) [🔗](#lib:operator%22%22y,year) `constexpr chrono::year operator""y(unsigned long long y) noexcept; ` [10](#year.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4887) *Returns*: year{static_cast(y)}[.](#year.nonmembers-10.sentence-1) ### [30.8.6](#wd) Class weekday [[time.cal.wd]](time.cal.wd) #### [30.8.6.1](#wd.overview) Overview [[time.cal.wd.overview]](time.cal.wd.overview) namespace std::chrono {class weekday {unsigned char wd_; // *exposition only*public: weekday() = default; constexpr explicit weekday(unsigned wd) noexcept; constexpr weekday(const sys_days& dp) noexcept; constexpr explicit weekday(const local_days& dp) noexcept; constexpr weekday& operator++() noexcept; constexpr weekday operator++(int) noexcept; constexpr weekday& operator--() noexcept; constexpr weekday operator--(int) noexcept; constexpr weekday& operator+=(const days& d) noexcept; constexpr weekday& operator-=(const days& d) noexcept; constexpr unsigned c_encoding() const noexcept; constexpr unsigned iso_encoding() const noexcept; constexpr bool ok() const noexcept; constexpr weekday_indexed operator[](unsigned index) const noexcept; constexpr weekday_last operator[](last_spec) const noexcept; };} [1](#wd.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4925) weekday represents a day of the week in the civil calendar[.](#wd.overview-1.sentence-1) It normally holds values in the range 0 to 6, corresponding to Sunday through Saturday, but it may hold non-negative values outside this range[.](#wd.overview-1.sentence-2) It can be constructed with any unsigned value, which will be subsequently truncated to fit into weekday's unspecified internal storage[.](#wd.overview-1.sentence-3) weekday meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#wd.overview-1.sentence-4) [*Note [1](#wd.overview-note-1)*: weekday is not[*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") because there is no universal consensus on which day is the first day of the week[.](#wd.overview-1.sentence-5) weekday's arithmetic operations treat the days of the week as a circular range, with no beginning and no end[.](#wd.overview-1.sentence-6) — *end note*] [2](#wd.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4941) weekday is a trivially copyable and standard-layout class type[.](#wd.overview-2.sentence-1) #### [30.8.6.2](#wd.members) Member functions [[time.cal.wd.members]](time.cal.wd.members) [🔗](#lib:weekday,constructor) `constexpr explicit weekday(unsigned wd) noexcept; ` [1](#wd.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4952) *Effects*: Initializes wd_ with wd == 7 ? 0 : wd[.](#wd.members-1.sentence-1) The value held is unspecified if wd is not in the range [0, 255][.](#wd.members-1.sentence-2) [🔗](#lib:weekday,constructor_) `constexpr weekday(const sys_days& dp) noexcept; ` [2](#wd.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4964) *Effects*: Computes what day of the week corresponds to the sys_days dp, and initializes that day of the week in wd_[.](#wd.members-2.sentence-1) [3](#wd.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4969) [*Example [1](#wd.members-example-1)*: If dp represents 1970-01-01, the constructed weekday represents Thursday by storing 4 in wd_[.](#wd.members-3.sentence-1) — *end example*] [🔗](#lib:weekday,constructor__) `constexpr explicit weekday(const local_days& dp) noexcept; ` [4](#wd.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4983) *Effects*: Computes what day of the week corresponds to the local_days dp, and initializes that day of the week in wd_[.](#wd.members-4.sentence-1) [5](#wd.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L4988) *Postconditions*: The value is identical to that constructed fromsys_days{dp.time_since_epoch()}[.](#wd.members-5.sentence-1) [🔗](#lib:operator++,weekday) `constexpr weekday& operator++() noexcept; ` [6](#wd.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5000) *Effects*: *this += days{1}[.](#wd.members-6.sentence-1) [7](#wd.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5004) *Returns*: *this[.](#wd.members-7.sentence-1) [🔗](#lib:operator++,weekday_) `constexpr weekday operator++(int) noexcept; ` [8](#wd.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5015) *Effects*: ++(*this)[.](#wd.members-8.sentence-1) [9](#wd.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5019) *Returns*: A copy of *this as it existed on entry to this member function[.](#wd.members-9.sentence-1) [🔗](#lib:operator--,weekday) `constexpr weekday& operator--() noexcept; ` [10](#wd.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5030) *Effects*: *this -= days{1}[.](#wd.members-10.sentence-1) [11](#wd.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5034) *Returns*: *this[.](#wd.members-11.sentence-1) [🔗](#lib:operator--,weekday_) `constexpr weekday operator--(int) noexcept; ` [12](#wd.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5045) *Effects*: --(*this)[.](#wd.members-12.sentence-1) [13](#wd.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5049) *Returns*: A copy of *this as it existed on entry to this member function[.](#wd.members-13.sentence-1) [🔗](#lib:operator+=,weekday) `constexpr weekday& operator+=(const days& d) noexcept; ` [14](#wd.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5060) *Effects*: *this = *this + d[.](#wd.members-14.sentence-1) [15](#wd.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5064) *Returns*: *this[.](#wd.members-15.sentence-1) [🔗](#lib:operator-=,weekday) `constexpr weekday& operator-=(const days& d) noexcept; ` [16](#wd.members-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5075) *Effects*: *this = *this - d[.](#wd.members-16.sentence-1) [17](#wd.members-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5079) *Returns*: *this[.](#wd.members-17.sentence-1) [🔗](#lib:c_encoding,weekday) `constexpr unsigned c_encoding() const noexcept; ` [18](#wd.members-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5090) *Returns*: wd_[.](#wd.members-18.sentence-1) [🔗](#lib:iso_encoding,weekday) `constexpr unsigned iso_encoding() const noexcept; ` [19](#wd.members-19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5101) *Returns*: wd_ == 0u ? 7u : wd_[.](#wd.members-19.sentence-1) [🔗](#lib:ok,weekday) `constexpr bool ok() const noexcept; ` [20](#wd.members-20) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5112) *Returns*: wd_ <= 6[.](#wd.members-20.sentence-1) [🔗](#lib:operator%5b%5d,weekday) `constexpr weekday_indexed operator[](unsigned index) const noexcept; ` [21](#wd.members-21) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5123) *Returns*: {*this, index}[.](#wd.members-21.sentence-1) [🔗](#lib:operator%5b%5d,weekday_) `constexpr weekday_last operator[](last_spec) const noexcept; ` [22](#wd.members-22) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5134) *Returns*: weekday_last{*this}[.](#wd.members-22.sentence-1) #### [30.8.6.3](#wd.nonmembers) Non-member functions [[time.cal.wd.nonmembers]](time.cal.wd.nonmembers) [🔗](#lib:operator==,weekday) `constexpr bool operator==(const weekday& x, const weekday& y) noexcept; ` [1](#wd.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5147) *Returns*: x.wd_ == y.wd_[.](#wd.nonmembers-1.sentence-1) [🔗](#lib:operator+,weekday) `constexpr weekday operator+(const weekday& x, const days& y) noexcept; ` [2](#wd.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5158) *Returns*: weekday{modulo(static_cast(x.wd_) + y.count(), 7)} where modulo(n, 7) computes the remainder of n divided by 7 using Euclidean division[.](#wd.nonmembers-2.sentence-1) [*Note [1](#wd.nonmembers-note-1)*: Given a divisor of 7, Euclidean division truncates towards negative infinity and always produces a remainder in the range of [0, 6][.](#wd.nonmembers-2.sentence-2) Assuming no overflow in the signed summation, this operation results in a weekday holding a value in the range [0, 6] even if !x.ok()[.](#wd.nonmembers-2.sentence-3) — *end note*] [*Example [1](#wd.nonmembers-example-1)*: Monday + days{6} == Sunday[.](#wd.nonmembers-2.sentence-4) — *end example*] [🔗](#lib:operator+,weekday_) `constexpr weekday operator+(const days& x, const weekday& y) noexcept; ` [3](#wd.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5181) *Returns*: y + x[.](#wd.nonmembers-3.sentence-1) [🔗](#lib:operator-,weekday) `constexpr weekday operator-(const weekday& x, const days& y) noexcept; ` [4](#wd.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5192) *Returns*: x + -y[.](#wd.nonmembers-4.sentence-1) [🔗](#lib:operator-,weekday_) `constexpr days operator-(const weekday& x, const weekday& y) noexcept; ` [5](#wd.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5203) *Returns*: If x.ok() == true and y.ok() == true, returns a value d in the range [days{0}, days{6}] satisfying y + d == x[.](#wd.nonmembers-5.sentence-1) Otherwise the value returned is unspecified[.](#wd.nonmembers-5.sentence-2) [*Example [2](#wd.nonmembers-example-2)*: Sunday - Monday == days{6}[.](#wd.nonmembers-5.sentence-3) — *end example*] [🔗](#lib:operator%3c%3c,weekday) `template basic_ostream& operator<<(basic_ostream& os, const weekday& wd); ` [6](#wd.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5224) *Effects*: Equivalent to:return os << (wd.ok() ? format(os.getloc(), *STATICALLY-WIDEN*("{:L%a}"), wd) : format(os.getloc(), *STATICALLY-WIDEN*("{} is not a valid weekday"), static_cast(wd.wd_))); [🔗](#lib:from_stream,weekday) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, weekday& wd, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [7](#wd.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5245) *Effects*: Attempts to parse the input stream is into the weekday wd using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#wd.nonmembers-7.sentence-1) If the parse fails to decode a valid weekday,is.setstate(ios_base​::​failbit) is called andwd is not modified[.](#wd.nonmembers-7.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#wd.nonmembers-7.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#wd.nonmembers-7.sentence-4) [8](#wd.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5259) *Returns*: is[.](#wd.nonmembers-8.sentence-1) ### [30.8.7](#wdidx) Class weekday_indexed [[time.cal.wdidx]](time.cal.wdidx) #### [30.8.7.1](#wdidx.overview) Overview [[time.cal.wdidx.overview]](time.cal.wdidx.overview) namespace std::chrono {class weekday_indexed { chrono::weekday wd_; // *exposition only*unsigned char index_; // *exposition only*public: weekday_indexed() = default; constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr unsigned index() const noexcept; constexpr bool ok() const noexcept; };} [1](#wdidx.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5286) weekday_indexed represents a weekday and a small index in the range 1 to 5[.](#wdidx.overview-1.sentence-1) This class is used to represent the first, second, third, fourth, or fifth weekday of a month[.](#wdidx.overview-1.sentence-2) [2](#wdidx.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5292) [*Note [1](#wdidx.overview-note-1)*: A weekday_indexed object can be constructed by indexing a weekday with an unsigned[.](#wdidx.overview-2.sentence-1) — *end note*] [*Example [1](#wdidx.overview-example-1)*: constexpr auto wdi = Sunday[2]; // wdi is the second Sunday of an as yet unspecified monthstatic_assert(wdi.weekday() == Sunday);static_assert(wdi.index() == 2); — *end example*] [3](#wdidx.overview-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5306) weekday_indexed is a trivially copyable and standard-layout class type[.](#wdidx.overview-3.sentence-1) #### [30.8.7.2](#wdidx.members) Member functions [[time.cal.wdidx.members]](time.cal.wdidx.members) [🔗](#lib:weekday_indexed,constructor) `constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept; ` [1](#wdidx.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5317) *Effects*: Initializes wd_ with wd and index_ with index[.](#wdidx.members-1.sentence-1) The values held are unspecified if !wd.ok() or index is not in the range [0, 7][.](#wdidx.members-1.sentence-2) [🔗](#lib:weekday,weekday_indexed) `constexpr chrono::weekday weekday() const noexcept; ` [2](#wdidx.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5329) *Returns*: wd_[.](#wdidx.members-2.sentence-1) [🔗](#lib:index,weekday_indexed) `constexpr unsigned index() const noexcept; ` [3](#wdidx.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5340) *Returns*: index_[.](#wdidx.members-3.sentence-1) [🔗](#lib:ok,weekday_indexed) `constexpr bool ok() const noexcept; ` [4](#wdidx.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5351) *Returns*: wd_.ok() && 1 <= index_ && index_ <= 5[.](#wdidx.members-4.sentence-1) #### [30.8.7.3](#wdidx.nonmembers) Non-member functions [[time.cal.wdidx.nonmembers]](time.cal.wdidx.nonmembers) [🔗](#lib:operator==,weekday_indexed) `constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; ` [1](#wdidx.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5364) *Returns*: x.weekday() == y.weekday() && x.index() == y.index()[.](#wdidx.nonmembers-1.sentence-1) [🔗](#lib:operator%3c%3c,weekday_indexed) `template basic_ostream& operator<<(basic_ostream& os, const weekday_indexed& wdi); ` [2](#wdidx.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5377) *Effects*: Equivalent to:auto i = wdi.index();return os << (i >= 1 && i <= 5 ? format(os.getloc(), *STATICALLY-WIDEN*("{:L}[{}]"), wdi.weekday(), i) : format(os.getloc(), *STATICALLY-WIDEN*("{:L}[{} is not a valid index]"), wdi.weekday(), i)); ### [30.8.8](#wdlast) Class weekday_last [[time.cal.wdlast]](time.cal.wdlast) #### [30.8.8.1](#wdlast.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](#wdlast.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5408) weekday_last represents the last weekday of a month[.](#wdlast.overview-1.sentence-1) [2](#wdlast.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5411) [*Note [1](#wdlast.overview-note-1)*: A weekday_last object can be constructed by indexing a weekday with last[.](#wdlast.overview-2.sentence-1) — *end note*] [*Example [1](#wdlast.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](#wdlast.overview-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5423) weekday_last is a trivially copyable and standard-layout class type[.](#wdlast.overview-3.sentence-1) #### [30.8.8.2](#wdlast.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](#wdlast.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5434) *Effects*: Initializes wd_ with wd[.](#wdlast.members-1.sentence-1) [🔗](#lib:weekday_last,weekday) `constexpr chrono::weekday weekday() const noexcept; ` [2](#wdlast.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5445) *Returns*: wd_[.](#wdlast.members-2.sentence-1) [🔗](#lib:ok,weekday_last) `constexpr bool ok() const noexcept; ` [3](#wdlast.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5456) *Returns*: wd_.ok()[.](#wdlast.members-3.sentence-1) #### [30.8.8.3](#wdlast.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](#wdlast.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5469) *Returns*: x.weekday() == y.weekday()[.](#wdlast.nonmembers-1.sentence-1) [🔗](#lib:operator%3c%3c,weekday_last) `template basic_ostream& operator<<(basic_ostream& os, const weekday_last& wdl); ` [2](#wdlast.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5482) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{:L}[last]"), wdl.weekday()); ### [30.8.9](#md) Class month_day [[time.cal.md]](time.cal.md) #### [30.8.9.1](#md.overview) Overview [[time.cal.md.overview]](time.cal.md.overview) namespace std::chrono {class month_day { chrono::month m_; // *exposition only* chrono::day d_; // *exposition only*public: month_day() = default; constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::day day() const noexcept; constexpr bool ok() const noexcept; };} [1](#md.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5512) month_day represents a specific day of a specific month, but with an unspecified year[.](#md.overview-1.sentence-1) month_day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#md.overview-1.sentence-2) [2](#md.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5518) month_day is a trivially copyable and standard-layout class type[.](#md.overview-2.sentence-1) #### [30.8.9.2](#md.members) Member functions [[time.cal.md.members]](time.cal.md.members) [🔗](#lib:month_day,constructor) `constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept; ` [1](#md.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5529) *Effects*: Initializes m_ with m, and d_ with d[.](#md.members-1.sentence-1) [🔗](#lib:month,month_day) `constexpr chrono::month month() const noexcept; ` [2](#md.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5540) *Returns*: m_[.](#md.members-2.sentence-1) [🔗](#lib:day,month_day) `constexpr chrono::day day() const noexcept; ` [3](#md.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5551) *Returns*: d_[.](#md.members-3.sentence-1) [🔗](#lib:ok,month_day) `constexpr bool ok() const noexcept; ` [4](#md.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5562) *Returns*: true ifm_.ok() is true,1d <= d_, andd_ is less than or equal to the number of days in month m_; otherwise returns false[.](#md.members-4.sentence-1) When m_ == February, the number of days is considered to be 29[.](#md.members-4.sentence-2) #### [30.8.9.3](#md.nonmembers) Non-member functions [[time.cal.md.nonmembers]](time.cal.md.nonmembers) [🔗](#lib:operator==,month_day) `constexpr bool operator==(const month_day& x, const month_day& y) noexcept; ` [1](#md.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5581) *Returns*: x.month() == y.month() && x.day() == y.day()[.](#md.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,month_day) `constexpr strong_ordering operator<=>(const month_day& x, const month_day& y) noexcept; ` [2](#md.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5592) *Effects*: Equivalent to:if (auto c = x.month() <=> y.month(); c != 0) return c;return x.day() <=> y.day(); [🔗](#lib:operator%3c%3c,month_day) `template basic_ostream& operator<<(basic_ostream& os, const month_day& md); ` [3](#md.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5609) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{:L}/{}"), md.month(), md.day()); [🔗](#lib:from_stream,month_day) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, month_day& md, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [4](#md.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5628) *Effects*: Attempts to parse the input stream is into the month_day md using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#md.nonmembers-4.sentence-1) If the parse fails to decode a valid month_day,is.setstate(ios_base​::​failbit) is called andmd is not modified[.](#md.nonmembers-4.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#md.nonmembers-4.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#md.nonmembers-4.sentence-4) [5](#md.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5642) *Returns*: is[.](#md.nonmembers-5.sentence-1) ### [30.8.10](#mdlast) Class month_day_last [[time.cal.mdlast]](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](#mdlast-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5664) month_day_last represents the last day of a month[.](#mdlast-1.sentence-1) [2](#mdlast-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5667) [*Note [1](#mdlast-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[.](#mdlast-2.sentence-1) — *end note*] [*Example [1](#mdlast-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](#mdlast-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5680) month_day_last is a trivially copyable and standard-layout class type[.](#mdlast-3.sentence-1) [🔗](#lib:month_day_last,constructor) `constexpr explicit month_day_last(const chrono::month& m) noexcept; ` [4](#mdlast-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5689) *Effects*: Initializes m_ with m[.](#mdlast-4.sentence-1) [🔗](#lib:month,month_day_last) `constexpr month month() const noexcept; ` [5](#mdlast-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5700) *Returns*: m_[.](#mdlast-5.sentence-1) [🔗](#lib:ok,month_day_last) `constexpr bool ok() const noexcept; ` [6](#mdlast-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5711) *Returns*: m_.ok()[.](#mdlast-6.sentence-1) [🔗](#lib:operator==,month_day_last) `constexpr bool operator==(const month_day_last& x, const month_day_last& y) noexcept; ` [7](#mdlast-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5722) *Returns*: x.month() == y.month()[.](#mdlast-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](#mdlast-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5733) *Returns*: x.month() <=> y.month()[.](#mdlast-8.sentence-1) [🔗](#lib:operator%3c%3c,month_day_last) `template basic_ostream& operator<<(basic_ostream& os, const month_day_last& mdl); ` [9](#mdlast-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5746) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{:L}/last"), mdl.month()); ### [30.8.11](#mwd) Class month_weekday [[time.cal.mwd]](time.cal.mwd) #### [30.8.11.1](#mwd.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](#mwd.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[.](#mwd.overview-1.sentence-1) To do this the month_weekday stores a month and a weekday_indexed[.](#mwd.overview-1.sentence-2) [2](#mwd.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5779) [*Example [1](#mwd.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](#mwd.overview-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5789) month_weekday is a trivially copyable and standard-layout class type[.](#mwd.overview-3.sentence-1) #### [30.8.11.2](#mwd.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](#mwd.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5800) *Effects*: Initializes m_ with m, and wdi_ with wdi[.](#mwd.members-1.sentence-1) [🔗](#lib:month,month_weekday) `constexpr chrono::month month() const noexcept; ` [2](#mwd.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5811) *Returns*: m_[.](#mwd.members-2.sentence-1) [🔗](#lib:weekday_indexed,month_weekday) `constexpr chrono::weekday_indexed weekday_indexed() const noexcept; ` [3](#mwd.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5822) *Returns*: wdi_[.](#mwd.members-3.sentence-1) [🔗](#lib:ok,month_weekday) `constexpr bool ok() const noexcept; ` [4](#mwd.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5833) *Returns*: m_.ok() && wdi_.ok()[.](#mwd.members-4.sentence-1) #### [30.8.11.3](#mwd.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](#mwd.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5846) *Returns*: x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed()[.](#mwd.nonmembers-1.sentence-1) [🔗](#lib:operator%3c%3c,month_weekday) `template basic_ostream& operator<<(basic_ostream& os, const month_weekday& mwd); ` [2](#mwd.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5859) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{:L}/{:L}"), mwd.month(), mwd.weekday_indexed()); ### [30.8.12](#mwdlast) Class month_weekday_last [[time.cal.mwdlast]](time.cal.mwdlast) #### [30.8.12.1](#mwdlast.overview) Overview [[time.cal.mwdlast.overview]](time.cal.mwdlast.overview) namespace std::chrono {class month_weekday_last { chrono::month m_; // *exposition only* chrono::weekday_last wdl_; // *exposition only*public:constexpr month_weekday_last(const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr bool ok() const noexcept; };} [1](#mwdlast.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5889) month_weekday_last represents the last weekday of a month, of an as yet unspecified year[.](#mwdlast.overview-1.sentence-1) To do this the month_weekday_last stores a month and a weekday_last[.](#mwdlast.overview-1.sentence-2) [2](#mwdlast.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5894) [*Example [1](#mwdlast.overview-example-1)*: constexpr auto mwd = February/Tuesday[last]; // mwd is the last Tuesday of February of an as yet unspecified yearstatic_assert(mwd.month() == February);static_assert(mwd.weekday_last() == Tuesday[last]); — *end example*] [3](#mwdlast.overview-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5904) month_weekday_last is a trivially copyable and standard-layout class type[.](#mwdlast.overview-3.sentence-1) #### [30.8.12.2](#mwdlast.members) Member functions [[time.cal.mwdlast.members]](time.cal.mwdlast.members) [🔗](#lib:month_weekday_last,constructor) `constexpr month_weekday_last(const chrono::month& m, const chrono::weekday_last& wdl) noexcept; ` [1](#mwdlast.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5916) *Effects*: Initializes m_ with m, and wdl_ with wdl[.](#mwdlast.members-1.sentence-1) [🔗](#lib:month,month_weekday_last) `constexpr chrono::month month() const noexcept; ` [2](#mwdlast.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5927) *Returns*: m_[.](#mwdlast.members-2.sentence-1) [🔗](#lib:weekday_last,month_weekday_last) `constexpr chrono::weekday_last weekday_last() const noexcept; ` [3](#mwdlast.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5938) *Returns*: wdl_[.](#mwdlast.members-3.sentence-1) [🔗](#lib:ok,month_weekday_last) `constexpr bool ok() const noexcept; ` [4](#mwdlast.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5949) *Returns*: m_.ok() && wdl_.ok()[.](#mwdlast.members-4.sentence-1) #### [30.8.12.3](#mwdlast.nonmembers) Non-member functions [[time.cal.mwdlast.nonmembers]](time.cal.mwdlast.nonmembers) [🔗](#lib:operator==,month_weekday_last) `constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept; ` [1](#mwdlast.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5962) *Returns*: x.month() == y.month() && x.weekday_last() == y.weekday_last()[.](#mwdlast.nonmembers-1.sentence-1) [🔗](#lib:operator%3c%3c,month_weekday_last) `template basic_ostream& operator<<(basic_ostream& os, const month_weekday_last& mwdl); ` [2](#mwdlast.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L5975) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{:L}/{:L}"), mwdl.month(), mwdl.weekday_last()); ### [30.8.13](#ym) Class year_month [[time.cal.ym]](time.cal.ym) #### [30.8.13.1](#ym.overview) Overview [[time.cal.ym.overview]](time.cal.ym.overview) namespace std::chrono {class year_month { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only*public: year_month() = default; constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr year_month& operator+=(const months& dm) noexcept; constexpr year_month& operator-=(const months& dm) noexcept; constexpr year_month& operator+=(const years& dy) noexcept; constexpr year_month& operator-=(const years& dy) noexcept; constexpr bool ok() const noexcept; };} [1](#ym.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6012) year_month represents a specific month of a specific year, but with an unspecified day[.](#ym.overview-1.sentence-1) year_month is a field-based time point with a resolution of months[.](#ym.overview-1.sentence-2) year_month meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#ym.overview-1.sentence-3) [2](#ym.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6019) year_month is a trivially copyable and standard-layout class type[.](#ym.overview-2.sentence-1) #### [30.8.13.2](#ym.members) Member functions [[time.cal.ym.members]](time.cal.ym.members) [🔗](#lib:year_month,constructor) `constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept; ` [1](#ym.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6030) *Effects*: Initializes y_ with y, and m_ with m[.](#ym.members-1.sentence-1) [🔗](#lib:year,year_month) `constexpr chrono::year year() const noexcept; ` [2](#ym.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6041) *Returns*: y_[.](#ym.members-2.sentence-1) [🔗](#lib:month,year_month) `constexpr chrono::month month() const noexcept; ` [3](#ym.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6052) *Returns*: m_[.](#ym.members-3.sentence-1) [🔗](#lib:operator+=,year_month) `constexpr year_month& operator+=(const months& dm) noexcept; ` [4](#ym.members-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"))[.](#ym.members-4.sentence-1) [5](#ym.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6071) *Effects*: *this = *this + dm[.](#ym.members-5.sentence-1) [6](#ym.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6075) *Returns*: *this[.](#ym.members-6.sentence-1) [🔗](#lib:operator-=,year_month) `constexpr year_month& operator-=(const months& dm) noexcept; ` [7](#ym.members-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"))[.](#ym.members-7.sentence-1) [8](#ym.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6094) *Effects*: *this = *this - dm[.](#ym.members-8.sentence-1) [9](#ym.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6098) *Returns*: *this[.](#ym.members-9.sentence-1) [🔗](#lib:operator+=,year_month_) `constexpr year_month& operator+=(const years& dy) noexcept; ` [10](#ym.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6109) *Effects*: *this = *this + dy[.](#ym.members-10.sentence-1) [11](#ym.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6113) *Returns*: *this[.](#ym.members-11.sentence-1) [🔗](#lib:operator-=,year_month_) `constexpr year_month& operator-=(const years& dy) noexcept; ` [12](#ym.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6124) *Effects*: *this = *this - dy[.](#ym.members-12.sentence-1) [13](#ym.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6128) *Returns*: *this[.](#ym.members-13.sentence-1) [🔗](#lib:ok,year_month) `constexpr bool ok() const noexcept; ` [14](#ym.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6139) *Returns*: y_.ok() && m_.ok()[.](#ym.members-14.sentence-1) #### [30.8.13.3](#ym.nonmembers) Non-member functions [[time.cal.ym.nonmembers]](time.cal.ym.nonmembers) [🔗](#lib:operator==,year_month) `constexpr bool operator==(const year_month& x, const year_month& y) noexcept; ` [1](#ym.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6152) *Returns*: x.year() == y.year() && x.month() == y.month()[.](#ym.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,year_month) `constexpr strong_ordering operator<=>(const year_month& x, const year_month& y) noexcept; ` [2](#ym.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6163) *Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;return x.month() <=> y.month(); [🔗](#lib:operator+,year_month) `constexpr year_month operator+(const year_month& ym, const months& dm) noexcept; ` [3](#ym.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6178) *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"))[.](#ym.nonmembers-3.sentence-1) [4](#ym.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6186) *Returns*: A year_month value z such that z.ok() && z - ym == dm is true[.](#ym.nonmembers-4.sentence-1) [5](#ym.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6191) *Complexity*: O(1) with respect to the value of dm[.](#ym.nonmembers-5.sentence-1) [🔗](#lib:operator+,year_month_) `constexpr year_month operator+(const months& dm, const year_month& ym) noexcept; ` [6](#ym.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6202) *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"))[.](#ym.nonmembers-6.sentence-1) [7](#ym.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6210) *Returns*: ym + dm[.](#ym.nonmembers-7.sentence-1) [🔗](#lib:operator-,year_month) `constexpr year_month operator-(const year_month& ym, const months& dm) noexcept; ` [8](#ym.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6221) *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"))[.](#ym.nonmembers-8.sentence-1) [9](#ym.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6229) *Returns*: ym + -dm[.](#ym.nonmembers-9.sentence-1) [🔗](#lib:operator-,year_month_) `constexpr months operator-(const year_month& x, const year_month& y) noexcept; ` [10](#ym.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6240) *Returns*: x.year() - y.year() + months{static_cast(unsigned{x.month()}) -static_cast(unsigned{y.month()})} [🔗](#lib:operator+,year_month__) `constexpr year_month operator+(const year_month& ym, const years& dy) noexcept; ` [11](#ym.nonmembers-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6254) *Returns*: (ym.year() + dy) / ym.month()[.](#ym.nonmembers-11.sentence-1) [🔗](#lib:operator+,year_month___) `constexpr year_month operator+(const years& dy, const year_month& ym) noexcept; ` [12](#ym.nonmembers-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6265) *Returns*: ym + dy[.](#ym.nonmembers-12.sentence-1) [🔗](#lib:operator-,year_month__) `constexpr year_month operator-(const year_month& ym, const years& dy) noexcept; ` [13](#ym.nonmembers-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6276) *Returns*: ym + -dy[.](#ym.nonmembers-13.sentence-1) [🔗](#lib:operator%3c%3c,year_month) `template basic_ostream& operator<<(basic_ostream& os, const year_month& ym); ` [14](#ym.nonmembers-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6289) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{}/{:L}"), ym.year(), ym.month()); [🔗](#lib:from_stream,year_month) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, year_month& ym, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [15](#ym.nonmembers-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6308) *Effects*: Attempts to parse the input stream is into the year_month ym using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#ym.nonmembers-15.sentence-1) If the parse fails to decode a valid year_month,is.setstate(ios_base​::​failbit) is called andym is not modified[.](#ym.nonmembers-15.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#ym.nonmembers-15.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#ym.nonmembers-15.sentence-4) [16](#ym.nonmembers-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6322) *Returns*: is[.](#ym.nonmembers-16.sentence-1) ### [30.8.14](#ymd) Class year_month_day [[time.cal.ymd]](time.cal.ymd) #### [30.8.14.1](#ymd.overview) Overview [[time.cal.ymd.overview]](time.cal.ymd.overview) namespace std::chrono {class year_month_day { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::day d_; // *exposition only*public: year_month_day() = default; constexpr year_month_day(const chrono::year& y, const chrono::month& m, const chrono::day& d) noexcept; constexpr year_month_day(const year_month_day_last& ymdl) noexcept; constexpr year_month_day(const sys_days& dp) noexcept; constexpr explicit year_month_day(const local_days& dp) noexcept; constexpr year_month_day& operator+=(const months& m) noexcept; constexpr year_month_day& operator-=(const months& m) noexcept; constexpr year_month_day& operator+=(const years& y) noexcept; constexpr year_month_day& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::day day() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };} [1](#ymd.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6363) year_month_day represents a specific year, month, and day[.](#ymd.overview-1.sentence-1) year_month_day is a field-based time point with a resolution of days[.](#ymd.overview-1.sentence-2) [*Note [1](#ymd.overview-note-1)*: year_month_day supports years- and months-oriented arithmetic, but not days-oriented arithmetic[.](#ymd.overview-1.sentence-3) For the latter, there is a conversion to sys_days, which efficiently supports days-oriented arithmetic[.](#ymd.overview-1.sentence-4) — *end note*] year_month_day meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#ymd.overview-1.sentence-5) [2](#ymd.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6375) year_month_day is a trivially copyable and standard-layout class type[.](#ymd.overview-2.sentence-1) #### [30.8.14.2](#ymd.members) Member functions [[time.cal.ymd.members]](time.cal.ymd.members) [🔗](#lib:year_month_day,constructor) `constexpr year_month_day(const chrono::year& y, const chrono::month& m, const chrono::day& d) noexcept; ` [1](#ymd.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6387) *Effects*: Initializesy_ with y,m_ with m, andd_ with d[.](#ymd.members-1.sentence-1) [🔗](#lib:year_month_day,constructor_) `constexpr year_month_day(const year_month_day_last& ymdl) noexcept; ` [2](#ymd.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6401) *Effects*: Initializesy_ with ymdl.year(),m_ with ymdl.month(), andd_ with ymdl.day()[.](#ymd.members-2.sentence-1) [*Note [1](#ymd.members-note-1)*: This conversion from year_month_day_last to year_month_day can be more efficient than converting a year_month_day_last to a sys_days, and then converting that sys_days to a year_month_day[.](#ymd.members-2.sentence-2) — *end note*] [🔗](#lib:year_month_day,constructor__) `constexpr year_month_day(const sys_days& dp) noexcept; ` [3](#ymd.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6420) *Effects*: Constructs an object of type year_month_day that corresponds to the date represented by dp[.](#ymd.members-3.sentence-1) [4](#ymd.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6425) *Remarks*: For any value ymd of type year_month_day for which ymd.ok() is true,ymd == year_month_day{sys_days{ymd}} is true[.](#ymd.members-4.sentence-1) [🔗](#lib:year_month_day,constructor___) `constexpr explicit year_month_day(const local_days& dp) noexcept; ` [5](#ymd.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6439) *Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#ymd.members-5.sentence-1) [🔗](#lib:operator+=,year_month_day) `constexpr year_month_day& operator+=(const months& m) noexcept; ` [6](#ymd.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6450) *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"))[.](#ymd.members-6.sentence-1) [7](#ymd.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6458) *Effects*: *this = *this + m[.](#ymd.members-7.sentence-1) [8](#ymd.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6462) *Returns*: *this[.](#ymd.members-8.sentence-1) [🔗](#lib:operator-=,year_month_day) `constexpr year_month_day& operator-=(const months& m) noexcept; ` [9](#ymd.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6473) *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"))[.](#ymd.members-9.sentence-1) [10](#ymd.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6481) *Effects*: *this = *this - m[.](#ymd.members-10.sentence-1) [11](#ymd.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6485) *Returns*: *this[.](#ymd.members-11.sentence-1) [🔗](#lib:operator+=,year_month_day_) `constexpr year_month_day& year_month_day::operator+=(const years& y) noexcept; ` [12](#ymd.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6496) *Effects*: *this = *this + y[.](#ymd.members-12.sentence-1) [13](#ymd.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6500) *Returns*: *this[.](#ymd.members-13.sentence-1) [🔗](#lib:operator-=,year_month_day_) `constexpr year_month_day& year_month_day::operator-=(const years& y) noexcept; ` [14](#ymd.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6511) *Effects*: *this = *this - y[.](#ymd.members-14.sentence-1) [15](#ymd.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6515) *Returns*: *this[.](#ymd.members-15.sentence-1) [🔗](#lib:year,year_month_day) `constexpr chrono::year year() const noexcept; ` [16](#ymd.members-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6526) *Returns*: y_[.](#ymd.members-16.sentence-1) [🔗](#lib:month,year_month_day) `constexpr chrono::month month() const noexcept; ` [17](#ymd.members-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6537) *Returns*: m_[.](#ymd.members-17.sentence-1) [🔗](#lib:day,year_month_day) `constexpr chrono::day day() const noexcept; ` [18](#ymd.members-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6548) *Returns*: d_[.](#ymd.members-18.sentence-1) [🔗](#lib:operator_sys_days,year_month_day) `constexpr operator sys_days() const noexcept; ` [19](#ymd.members-19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6559) *Returns*: If ok(), returns a sys_days holding a count of days from the sys_days epoch to *this (a negative value if *this represents a date prior to the sys_days epoch)[.](#ymd.members-19.sentence-1) Otherwise, if y_.ok() && m_.ok() is true, returns sys_days{y_/m_/1d} + (d_ - 1d)[.](#ymd.members-19.sentence-2) Otherwise the value returned is unspecified[.](#ymd.members-19.sentence-3) [20](#ymd.members-20) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6569) *Remarks*: A sys_days in the range [days{-12687428}, days{11248737}] which is converted to a year_month_day has the same value when converted back to a sys_days[.](#ymd.members-20.sentence-1) [21](#ymd.members-21) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6575) [*Example [1](#ymd.members-example-1)*: static_assert(year_month_day{sys_days{2017y/January/0}} == 2016y/December/31);static_assert(year_month_day{sys_days{2017y/January/31}} == 2017y/January/31);static_assert(year_month_day{sys_days{2017y/January/32}} == 2017y/February/1); — *end example*] [🔗](#lib:operator_local_days,year_month_day) `constexpr explicit operator local_days() const noexcept; ` [22](#ymd.members-22) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6591) *Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#ymd.members-22.sentence-1) [🔗](#lib:ok,year_month_day) `constexpr bool ok() const noexcept; ` [23](#ymd.members-23) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6602) *Returns*: If y_.ok() is true, and m_.ok() is true, and d_ is in the range [1d, (y_/m_/last).day()], then returns true; otherwise returns false[.](#ymd.members-23.sentence-1) #### [30.8.14.3](#ymd.nonmembers) Non-member functions [[time.cal.ymd.nonmembers]](time.cal.ymd.nonmembers) [🔗](#lib:operator==,year_month_day) `constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept; ` [1](#ymd.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6618) *Returns*: x.year() == y.year() && x.month() == y.month() && x.day() == y.day()[.](#ymd.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,year_month_day) `constexpr strong_ordering operator<=>(const year_month_day& x, const year_month_day& y) noexcept; ` [2](#ymd.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6629) *Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;if (auto c = x.month() <=> y.month(); c != 0) return c;return x.day() <=> y.day(); [🔗](#lib:operator+,year_month_day) `constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept; ` [3](#ymd.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6645) *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"))[.](#ymd.nonmembers-3.sentence-1) [4](#ymd.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6653) *Returns*: (ymd.year() / ymd.month() + dm) / ymd.day()[.](#ymd.nonmembers-4.sentence-1) [5](#ymd.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6657) [*Note [1](#ymd.nonmembers-note-1)*: If ymd.day() is in the range [1d, 28d],ok() will return true for the resultant year_month_day[.](#ymd.nonmembers-5.sentence-1) — *end note*] [🔗](#lib:operator+,year_month_day_) `constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept; ` [6](#ymd.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6671) *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"))[.](#ymd.nonmembers-6.sentence-1) [7](#ymd.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6679) *Returns*: ymd + dm[.](#ymd.nonmembers-7.sentence-1) [🔗](#lib:operator-,year_month_day) `constexpr year_month_day operator-(const year_month_day& ymd, const months& dm) noexcept; ` [8](#ymd.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6690) *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"))[.](#ymd.nonmembers-8.sentence-1) [9](#ymd.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6698) *Returns*: ymd + (-dm)[.](#ymd.nonmembers-9.sentence-1) [🔗](#lib:operator+,year_month_day__) `constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept; ` [10](#ymd.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6709) *Returns*: (ymd.year() + dy) / ymd.month() / ymd.day()[.](#ymd.nonmembers-10.sentence-1) [11](#ymd.nonmembers-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6713) [*Note [2](#ymd.nonmembers-note-2)*: If ymd.month() is February and ymd.day() is not in the range [1d, 28d],ok() can return false for the resultant year_month_day[.](#ymd.nonmembers-11.sentence-1) — *end note*] [🔗](#lib:operator+,year_month_day___) `constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept; ` [12](#ymd.nonmembers-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6728) *Returns*: ymd + dy[.](#ymd.nonmembers-12.sentence-1) [🔗](#lib:operator-,year_month_day_) `constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept; ` [13](#ymd.nonmembers-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6739) *Returns*: ymd + (-dy)[.](#ymd.nonmembers-13.sentence-1) [🔗](#lib:operator%3c%3c,year_month_day) `template basic_ostream& operator<<(basic_ostream& os, const year_month_day& ymd); ` [14](#ymd.nonmembers-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6752) *Effects*: Equivalent to:return os << (ymd.ok() ? format(*STATICALLY-WIDEN*("{:%F}"), ymd) : format(*STATICALLY-WIDEN*("{:%F} is not a valid date"), ymd)); [🔗](#lib:from_stream,year_month_day) `template> basic_istream& from_stream(basic_istream& is, const charT* fmt, year_month_day& ymd, basic_string* abbrev = nullptr, minutes* offset = nullptr); ` [15](#ymd.nonmembers-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6772) *Effects*: Attempts to parse the input stream is into the year_month_day ymd using the format flags given in the NTCTS fmt as specified in [[time.parse]](time.parse "30.13 Parsing")[.](#ymd.nonmembers-15.sentence-1) If the parse fails to decode a valid year_month_day,is.setstate(ios_base​::​failbit) is called andymd is not modified[.](#ymd.nonmembers-15.sentence-2) If %Z is used and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null[.](#ymd.nonmembers-15.sentence-3) If %z (or a modified variant) is used and successfully parsed, that value will be assigned to *offset if offset is non-null[.](#ymd.nonmembers-15.sentence-4) [16](#ymd.nonmembers-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6786) *Returns*: is[.](#ymd.nonmembers-16.sentence-1) ### [30.8.15](#ymdlast) Class year_month_day_last [[time.cal.ymdlast]](time.cal.ymdlast) #### [30.8.15.1](#ymdlast.overview) Overview [[time.cal.ymdlast.overview]](time.cal.ymdlast.overview) namespace std::chrono {class year_month_day_last { chrono::year y_; // *exposition only* chrono::month_day_last mdl_; // *exposition only*public:constexpr year_month_day_last(const chrono::year& y, const chrono::month_day_last& mdl) noexcept; constexpr year_month_day_last& operator+=(const months& m) noexcept; constexpr year_month_day_last& operator-=(const months& m) noexcept; constexpr year_month_day_last& operator+=(const years& y) noexcept; constexpr year_month_day_last& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::month_day_last month_day_last() const noexcept; constexpr chrono::day day() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };} [1](#ymdlast.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6823) year_month_day_last represents the last day of a specific year and month[.](#ymdlast.overview-1.sentence-1) year_month_day_last is a field-based time point with a resolution of days, except that it is restricted to pointing to the last day of a year and month[.](#ymdlast.overview-1.sentence-2) [*Note [1](#ymdlast.overview-note-1)*: year_month_day_last supports years- and months-oriented arithmetic, but not days-oriented arithmetic[.](#ymdlast.overview-1.sentence-3) For the latter, there is a conversion to sys_days, which efficiently supports days-oriented arithmetic[.](#ymdlast.overview-1.sentence-4) — *end note*] year_month_day_last meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) and [*Cpp17LessThanComparable*](utility.arg.requirements#:Cpp17LessThanComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [29](utility.arg.requirements#tab:cpp17.lessthancomparable "Table 29: Cpp17LessThanComparable requirements")) requirements[.](#ymdlast.overview-1.sentence-5) [2](#ymdlast.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6836) year_month_day_last is a trivially copyable and standard-layout class type[.](#ymdlast.overview-2.sentence-1) #### [30.8.15.2](#ymdlast.members) Member functions [[time.cal.ymdlast.members]](time.cal.ymdlast.members) [🔗](#lib:year_month_day_last,constructor) `constexpr year_month_day_last(const chrono::year& y, const chrono::month_day_last& mdl) noexcept; ` [1](#ymdlast.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6848) *Effects*: Initializes y_ with y and mdl_ with mdl[.](#ymdlast.members-1.sentence-1) [🔗](#lib:operator+=,year_month_day_last) `constexpr year_month_day_last& operator+=(const months& m) noexcept; ` [2](#ymdlast.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6859) *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"))[.](#ymdlast.members-2.sentence-1) [3](#ymdlast.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6867) *Effects*: *this = *this + m[.](#ymdlast.members-3.sentence-1) [4](#ymdlast.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6871) *Returns*: *this[.](#ymdlast.members-4.sentence-1) [🔗](#lib:operator-=,year_month_day_last) `constexpr year_month_day_last& operator-=(const months& m) noexcept; ` [5](#ymdlast.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6882) *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"))[.](#ymdlast.members-5.sentence-1) [6](#ymdlast.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6890) *Effects*: *this = *this - m[.](#ymdlast.members-6.sentence-1) [7](#ymdlast.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6894) *Returns*: *this[.](#ymdlast.members-7.sentence-1) [🔗](#lib:operator+=,year_month_day_last_) `constexpr year_month_day_last& operator+=(const years& y) noexcept; ` [8](#ymdlast.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6905) *Effects*: *this = *this + y[.](#ymdlast.members-8.sentence-1) [9](#ymdlast.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6909) *Returns*: *this[.](#ymdlast.members-9.sentence-1) [🔗](#lib:operator-=,year_month_day_last_) `constexpr year_month_day_last& operator-=(const years& y) noexcept; ` [10](#ymdlast.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6920) *Effects*: *this = *this - y[.](#ymdlast.members-10.sentence-1) [11](#ymdlast.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6924) *Returns*: *this[.](#ymdlast.members-11.sentence-1) [🔗](#lib:year,year_month_day_last) `constexpr chrono::year year() const noexcept; ` [12](#ymdlast.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6935) *Returns*: y_[.](#ymdlast.members-12.sentence-1) [🔗](#lib:month,year_month_day_last) `constexpr chrono::month month() const noexcept; ` [13](#ymdlast.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6946) *Returns*: mdl_.month()[.](#ymdlast.members-13.sentence-1) [🔗](#lib:month_day_last,year_month_day_last) `constexpr chrono::month_day_last month_day_last() const noexcept; ` [14](#ymdlast.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6957) *Returns*: mdl_[.](#ymdlast.members-14.sentence-1) [🔗](#lib:day,year_month_day_last) `constexpr chrono::day day() const noexcept; ` [15](#ymdlast.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6968) *Returns*: If ok() is true, returns a day representing the last day of the (year, month) pair represented by *this[.](#ymdlast.members-15.sentence-1) Otherwise, the returned value is unspecified[.](#ymdlast.members-15.sentence-2) [16](#ymdlast.members-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6976) [*Note [1](#ymdlast.members-note-1)*: This value might be computed on demand[.](#ymdlast.members-16.sentence-1) — *end note*] [🔗](#lib:operator_sys_days,year_month_day_last) `constexpr operator sys_days() const noexcept; ` [17](#ymdlast.members-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6988) *Returns*: sys_days{year()/month()/day()}[.](#ymdlast.members-17.sentence-1) [🔗](#lib:operator_local_days,year_month_day_last) `constexpr explicit operator local_days() const noexcept; ` [18](#ymdlast.members-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L6999) *Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#ymdlast.members-18.sentence-1) [🔗](#lib:ok,year_month_day_last) `constexpr bool ok() const noexcept; ` [19](#ymdlast.members-19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7010) *Returns*: y_.ok() && mdl_.ok()[.](#ymdlast.members-19.sentence-1) #### [30.8.15.3](#ymdlast.nonmembers) Non-member functions [[time.cal.ymdlast.nonmembers]](time.cal.ymdlast.nonmembers) [🔗](#lib:operator==,year_month_day_last) `constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept; ` [1](#ymdlast.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7023) *Returns*: x.year() == y.year() && x.month_day_last() == y.month_day_last()[.](#ymdlast.nonmembers-1.sentence-1) [🔗](#lib:operator%3c=%3e,year_month_day_last) `constexpr strong_ordering operator<=>(const year_month_day_last& x, const year_month_day_last& y) noexcept; ` [2](#ymdlast.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7035) *Effects*: Equivalent to:if (auto c = x.year() <=> y.year(); c != 0) return c;return x.month_day_last() <=> y.month_day_last(); [🔗](#lib:operator+,year_month_day_last) `constexpr year_month_day_last operator+(const year_month_day_last& ymdl, const months& dm) noexcept; ` [3](#ymdlast.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7051) *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"))[.](#ymdlast.nonmembers-3.sentence-1) [4](#ymdlast.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7059) *Returns*: (ymdl.year() / ymdl.month() + dm) / last[.](#ymdlast.nonmembers-4.sentence-1) [🔗](#lib:operator+,year_month_day_last_) `constexpr year_month_day_last operator+(const months& dm, const year_month_day_last& ymdl) noexcept; ` [5](#ymdlast.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7071) *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"))[.](#ymdlast.nonmembers-5.sentence-1) [6](#ymdlast.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7079) *Returns*: ymdl + dm[.](#ymdlast.nonmembers-6.sentence-1) [🔗](#lib:operator-,year_month_day_last) `constexpr year_month_day_last operator-(const year_month_day_last& ymdl, const months& dm) noexcept; ` [7](#ymdlast.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7091) *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"))[.](#ymdlast.nonmembers-7.sentence-1) [8](#ymdlast.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7099) *Returns*: ymdl + (-dm)[.](#ymdlast.nonmembers-8.sentence-1) [🔗](#lib:operator+,year_month_day_last__) `constexpr year_month_day_last operator+(const year_month_day_last& ymdl, const years& dy) noexcept; ` [9](#ymdlast.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7111) *Returns*: {ymdl.year()+dy, ymdl.month_day_last()}[.](#ymdlast.nonmembers-9.sentence-1) [🔗](#lib:operator+,year_month_day_last___) `constexpr year_month_day_last operator+(const years& dy, const year_month_day_last& ymdl) noexcept; ` [10](#ymdlast.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7123) *Returns*: ymdl + dy[.](#ymdlast.nonmembers-10.sentence-1) [🔗](#lib:operator-,year_month_day_last_) `constexpr year_month_day_last operator-(const year_month_day_last& ymdl, const years& dy) noexcept; ` [11](#ymdlast.nonmembers-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7135) *Returns*: ymdl + (-dy)[.](#ymdlast.nonmembers-11.sentence-1) [🔗](#lib:operator%3c%3c,year_month_day_last) `template basic_ostream& operator<<(basic_ostream& os, const year_month_day_last& ymdl); ` [12](#ymdlast.nonmembers-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7148) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{}/{:L}"), ymdl.year(), ymdl.month_day_last()); ### [30.8.16](#ymwd) Class year_month_weekday [[time.cal.ymwd]](time.cal.ymwd) #### [30.8.16.1](#ymwd.overview) Overview [[time.cal.ymwd.overview]](time.cal.ymwd.overview) namespace std::chrono {class year_month_weekday { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::weekday_indexed wdi_; // *exposition only*public: year_month_weekday() = default; constexpr year_month_weekday(const chrono::year& y, const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; constexpr year_month_weekday(const sys_days& dp) noexcept; constexpr explicit year_month_weekday(const local_days& dp) noexcept; constexpr year_month_weekday& operator+=(const months& m) noexcept; constexpr year_month_weekday& operator-=(const months& m) noexcept; constexpr year_month_weekday& operator+=(const years& y) noexcept; constexpr year_month_weekday& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr unsigned index() const noexcept; constexpr chrono::weekday_indexed weekday_indexed() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };} [1](#ymwd.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7194) year_month_weekday represents a specific year, month, and nth weekday of the month[.](#ymwd.overview-1.sentence-1) year_month_weekday is a field-based time point with a resolution of days[.](#ymwd.overview-1.sentence-2) [*Note [1](#ymwd.overview-note-1)*: year_month_weekday supports years- and months-oriented arithmetic, but not days-oriented arithmetic[.](#ymwd.overview-1.sentence-3) For the latter, there is a conversion to sys_days, which efficiently supports days-oriented arithmetic[.](#ymwd.overview-1.sentence-4) — *end note*] year_month_weekday meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#ymwd.overview-1.sentence-5) [2](#ymwd.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7206) year_month_weekday is a trivially copyable and standard-layout class type[.](#ymwd.overview-2.sentence-1) #### [30.8.16.2](#ymwd.members) Member functions [[time.cal.ymwd.members]](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](#ymwd.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7218) *Effects*: Initializes y_ with y, m_ with m, and wdi_ with wdi[.](#ymwd.members-1.sentence-1) [🔗](#lib:year_month_weekday,constructor_) `constexpr year_month_weekday(const sys_days& dp) noexcept; ` [2](#ymwd.members-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[.](#ymwd.members-2.sentence-1) [3](#ymwd.members-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[.](#ymwd.members-3.sentence-1) [🔗](#lib:year_month_weekday,constructor__) `constexpr explicit year_month_weekday(const local_days& dp) noexcept; ` [4](#ymwd.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7247) *Effects*: Equivalent to constructing with sys_days{dp.time_since_epoch()}[.](#ymwd.members-4.sentence-1) [🔗](#lib:operator+=,year_month_weekday) `constexpr year_month_weekday& operator+=(const months& m) noexcept; ` [5](#ymwd.members-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"))[.](#ymwd.members-5.sentence-1) [6](#ymwd.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7266) *Effects*: *this = *this + m[.](#ymwd.members-6.sentence-1) [7](#ymwd.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7270) *Returns*: *this[.](#ymwd.members-7.sentence-1) [🔗](#lib:operator-=,year_month_weekday) `constexpr year_month_weekday& operator-=(const months& m) noexcept; ` [8](#ymwd.members-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"))[.](#ymwd.members-8.sentence-1) [9](#ymwd.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7289) *Effects*: *this = *this - m[.](#ymwd.members-9.sentence-1) [10](#ymwd.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7293) *Returns*: *this[.](#ymwd.members-10.sentence-1) [🔗](#lib:operator+=,year_month_weekday_) `constexpr year_month_weekday& operator+=(const years& y) noexcept; ` [11](#ymwd.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7304) *Effects*: *this = *this + y[.](#ymwd.members-11.sentence-1) [12](#ymwd.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7308) *Returns*: *this[.](#ymwd.members-12.sentence-1) [🔗](#lib:operator-=,year_month_weekday_) `constexpr year_month_weekday& operator-=(const years& y) noexcept; ` [13](#ymwd.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7319) *Effects*: *this = *this - y[.](#ymwd.members-13.sentence-1) [14](#ymwd.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7323) *Returns*: *this[.](#ymwd.members-14.sentence-1) [🔗](#lib:year,year_month_weekday) `constexpr chrono::year year() const noexcept; ` [15](#ymwd.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7334) *Returns*: y_[.](#ymwd.members-15.sentence-1) [🔗](#lib:month,year_month_weekday) `constexpr chrono::month month() const noexcept; ` [16](#ymwd.members-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7345) *Returns*: m_[.](#ymwd.members-16.sentence-1) [🔗](#lib:weekday,year_month_weekday) `constexpr chrono::weekday weekday() const noexcept; ` [17](#ymwd.members-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7356) *Returns*: wdi_.weekday()[.](#ymwd.members-17.sentence-1) [🔗](#lib:index,year_month_weekday) `constexpr unsigned index() const noexcept; ` [18](#ymwd.members-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7367) *Returns*: wdi_.index()[.](#ymwd.members-18.sentence-1) [🔗](#lib:weekday_indexed,year_month_weekday) `constexpr chrono::weekday_indexed weekday_indexed() const noexcept; ` [19](#ymwd.members-19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7378) *Returns*: wdi_[.](#ymwd.members-19.sentence-1) [🔗](#lib:operator_sys_days,year_month_weekday) `constexpr operator sys_days() const noexcept; ` [20](#ymwd.members-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()[.](#ymwd.members-20.sentence-1) If index() is 0 the returned sys_days represents the date 7 days prior to the first weekday() of year()/month()[.](#ymwd.members-20.sentence-2) Otherwise the returned value is unspecified[.](#ymwd.members-20.sentence-3) [🔗](#lib:operator_local_days,year_month_weekday) `constexpr explicit operator local_days() const noexcept; ` [21](#ymwd.members-21) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7408) *Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#ymwd.members-21.sentence-1) [🔗](#lib:ok,year_month_weekday) `constexpr bool ok() const noexcept; ` [22](#ymwd.members-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[.](#ymwd.members-22.sentence-1) Otherwise, if *this represents a valid date, returns true[.](#ymwd.members-22.sentence-2) Otherwise, returns false[.](#ymwd.members-22.sentence-3) #### [30.8.16.3](#ymwd.nonmembers) Non-member functions [[time.cal.ymwd.nonmembers]](time.cal.ymwd.nonmembers) [🔗](#lib:operator==,year_month_weekday) `constexpr bool operator==(const year_month_weekday& x, const year_month_weekday& y) noexcept; ` [1](#ymwd.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7439) *Returns*: x.year() == y.year() && x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed() [🔗](#lib:operator+,year_month_weekday) `constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const months& dm) noexcept; ` [2](#ymwd.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7452) *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"))[.](#ymwd.nonmembers-2.sentence-1) [3](#ymwd.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7460) *Returns*: (ymwd.year() / ymwd.month() + dm) / ymwd.weekday_indexed()[.](#ymwd.nonmembers-3.sentence-1) [🔗](#lib:operator+,year_month_weekday_) `constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymwd) noexcept; ` [4](#ymwd.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7471) *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"))[.](#ymwd.nonmembers-4.sentence-1) [5](#ymwd.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7479) *Returns*: ymwd + dm[.](#ymwd.nonmembers-5.sentence-1) [🔗](#lib:operator-,year_month_weekday) `constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept; ` [6](#ymwd.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7490) *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"))[.](#ymwd.nonmembers-6.sentence-1) [7](#ymwd.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7498) *Returns*: ymwd + (-dm)[.](#ymwd.nonmembers-7.sentence-1) [🔗](#lib:operator+,year_month_weekday__) `constexpr year_month_weekday operator+(const year_month_weekday& ymwd, const years& dy) noexcept; ` [8](#ymwd.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7509) *Returns*: {ymwd.year()+dy, ymwd.month(), ymwd.weekday_indexed()}[.](#ymwd.nonmembers-8.sentence-1) [🔗](#lib:operator+,year_month_weekday___) `constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymwd) noexcept; ` [9](#ymwd.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7520) *Returns*: ymwd + dy[.](#ymwd.nonmembers-9.sentence-1) [🔗](#lib:operator-,year_month_weekday_) `constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept; ` [10](#ymwd.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7531) *Returns*: ymwd + (-dy)[.](#ymwd.nonmembers-10.sentence-1) [🔗](#lib:operator%3c%3c,year_month_weekday) `template basic_ostream& operator<<(basic_ostream& os, const year_month_weekday& ymwd); ` [11](#ymwd.nonmembers-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7544) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{}/{:L}/{:L}"), ymwd.year(), ymwd.month(), ymwd.weekday_indexed()); ### [30.8.17](#ymwdlast) Class year_month_weekday_last [[time.cal.ymwdlast]](time.cal.ymwdlast) #### [30.8.17.1](#ymwdlast.overview) Overview [[time.cal.ymwdlast.overview]](time.cal.ymwdlast.overview) namespace std::chrono {class year_month_weekday_last { chrono::year y_; // *exposition only* chrono::month m_; // *exposition only* chrono::weekday_last wdl_; // *exposition only*public:constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m, const chrono::weekday_last& wdl) noexcept; constexpr year_month_weekday_last& operator+=(const months& m) noexcept; constexpr year_month_weekday_last& operator-=(const months& m) noexcept; constexpr year_month_weekday_last& operator+=(const years& y) noexcept; constexpr year_month_weekday_last& operator-=(const years& y) noexcept; constexpr chrono::year year() const noexcept; constexpr chrono::month month() const noexcept; constexpr chrono::weekday weekday() const noexcept; constexpr chrono::weekday_last weekday_last() const noexcept; constexpr operator sys_days() const noexcept; constexpr explicit operator local_days() const noexcept; constexpr bool ok() const noexcept; };} [1](#ymwdlast.overview-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7586) year_month_weekday_last represents a specific year, month, and last weekday of the month[.](#ymwdlast.overview-1.sentence-1) year_month_weekday_last is a field-based time point with a resolution of days, except that it is restricted to pointing to the last weekday of a year and month[.](#ymwdlast.overview-1.sentence-2) [*Note [1](#ymwdlast.overview-note-1)*: year_month_weekday_last supports years- and months-oriented arithmetic, but not days-oriented arithmetic[.](#ymwdlast.overview-1.sentence-3) For the latter, there is a conversion to sys_days, which efficiently supports days-oriented arithmetic[.](#ymwdlast.overview-1.sentence-4) — *end note*] year_month_weekday_last meets the [*Cpp17EqualityComparable*](utility.arg.requirements#:Cpp17EqualityComparable "16.4.4.2 Template argument requirements [utility.arg.requirements]") (Table [28](utility.arg.requirements#tab:cpp17.equalitycomparable "Table 28: Cpp17EqualityComparable requirements")) requirements[.](#ymwdlast.overview-1.sentence-5) [2](#ymwdlast.overview-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7599) year_month_weekday_last is a trivially copyable and standard-layout class type[.](#ymwdlast.overview-2.sentence-1) #### [30.8.17.2](#ymwdlast.members) Member functions [[time.cal.ymwdlast.members]](time.cal.ymwdlast.members) [🔗](#lib:year_month_weekday_last,constructor) `constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m, const chrono::weekday_last& wdl) noexcept; ` [1](#ymwdlast.members-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7611) *Effects*: Initializes y_ with y, m_ with m, and wdl_ with wdl[.](#ymwdlast.members-1.sentence-1) [🔗](#lib:operator+=,year_month_weekday_last) `constexpr year_month_weekday_last& operator+=(const months& m) noexcept; ` [2](#ymwdlast.members-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7622) *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"))[.](#ymwdlast.members-2.sentence-1) [3](#ymwdlast.members-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7630) *Effects*: *this = *this + m[.](#ymwdlast.members-3.sentence-1) [4](#ymwdlast.members-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7634) *Returns*: *this[.](#ymwdlast.members-4.sentence-1) [🔗](#lib:operator-=,year_month_weekday_last) `constexpr year_month_weekday_last& operator-=(const months& m) noexcept; ` [5](#ymwdlast.members-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7645) *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"))[.](#ymwdlast.members-5.sentence-1) [6](#ymwdlast.members-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7653) *Effects*: *this = *this - m[.](#ymwdlast.members-6.sentence-1) [7](#ymwdlast.members-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7657) *Returns*: *this[.](#ymwdlast.members-7.sentence-1) [🔗](#lib:operator+=,year_month_weekday_last_) `constexpr year_month_weekday_last& operator+=(const years& y) noexcept; ` [8](#ymwdlast.members-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7668) *Effects*: *this = *this + y[.](#ymwdlast.members-8.sentence-1) [9](#ymwdlast.members-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7672) *Returns*: *this[.](#ymwdlast.members-9.sentence-1) [🔗](#lib:operator-=,year_month_weekday_last_) `constexpr year_month_weekday_last& operator-=(const years& y) noexcept; ` [10](#ymwdlast.members-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7683) *Effects*: *this = *this - y[.](#ymwdlast.members-10.sentence-1) [11](#ymwdlast.members-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7687) *Returns*: *this[.](#ymwdlast.members-11.sentence-1) [🔗](#lib:year,year_month_weekday_last) `constexpr chrono::year year() const noexcept; ` [12](#ymwdlast.members-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7698) *Returns*: y_[.](#ymwdlast.members-12.sentence-1) [🔗](#lib:month,year_month_weekday_last) `constexpr chrono::month month() const noexcept; ` [13](#ymwdlast.members-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7709) *Returns*: m_[.](#ymwdlast.members-13.sentence-1) [🔗](#lib:weekday,year_month_weekday_last) `constexpr chrono::weekday weekday() const noexcept; ` [14](#ymwdlast.members-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7720) *Returns*: wdl_.weekday()[.](#ymwdlast.members-14.sentence-1) [🔗](#lib:weekday_last,year_month_weekday_last) `constexpr chrono::weekday_last weekday_last() const noexcept; ` [15](#ymwdlast.members-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7731) *Returns*: wdl_[.](#ymwdlast.members-15.sentence-1) [🔗](#lib:operator_sys_days,year_month_weekday_last) `constexpr operator sys_days() const noexcept; ` [16](#ymwdlast.members-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7742) *Returns*: If ok() == true, returns a sys_days that represents the last weekday() of year()/month()[.](#ymwdlast.members-16.sentence-1) Otherwise the returned value is unspecified[.](#ymwdlast.members-16.sentence-2) [🔗](#lib:operator_local_days,year_month_weekday_last) `constexpr explicit operator local_days() const noexcept; ` [17](#ymwdlast.members-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7756) *Returns*: local_days{sys_days{*this}.time_since_epoch()}[.](#ymwdlast.members-17.sentence-1) [🔗](#lib:ok,year_month_weekday_last) `constexpr bool ok() const noexcept; ` [18](#ymwdlast.members-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7767) *Returns*: y_.ok() && m_.ok() && wdl_.ok()[.](#ymwdlast.members-18.sentence-1) #### [30.8.17.3](#ymwdlast.nonmembers) Non-member functions [[time.cal.ymwdlast.nonmembers]](time.cal.ymwdlast.nonmembers) [🔗](#lib:operator==,year_month_weekday_last) `constexpr bool operator==(const year_month_weekday_last& x, const year_month_weekday_last& y) noexcept; ` [1](#ymwdlast.nonmembers-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7781) *Returns*: x.year() == y.year() && x.month() == y.month() && x.weekday_last() == y.weekday_last() [🔗](#lib:operator+,year_month_weekday_last) `constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept; ` [2](#ymwdlast.nonmembers-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7795) *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"))[.](#ymwdlast.nonmembers-2.sentence-1) [3](#ymwdlast.nonmembers-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7803) *Returns*: (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()[.](#ymwdlast.nonmembers-3.sentence-1) [🔗](#lib:operator+,year_month_weekday_last_) `constexpr year_month_weekday_last operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept; ` [4](#ymwdlast.nonmembers-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7815) *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"))[.](#ymwdlast.nonmembers-4.sentence-1) [5](#ymwdlast.nonmembers-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7823) *Returns*: ymwdl + dm[.](#ymwdlast.nonmembers-5.sentence-1) [🔗](#lib:operator-,year_month_weekday_last) `constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept; ` [6](#ymwdlast.nonmembers-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7835) *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"))[.](#ymwdlast.nonmembers-6.sentence-1) [7](#ymwdlast.nonmembers-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7843) *Returns*: ymwdl + (-dm)[.](#ymwdlast.nonmembers-7.sentence-1) [🔗](#lib:operator+,year_month_weekday_last__) `constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept; ` [8](#ymwdlast.nonmembers-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7855) *Returns*: {ymwdl.year()+dy, ymwdl.month(), ymwdl.weekday_last()}[.](#ymwdlast.nonmembers-8.sentence-1) [🔗](#lib:operator+,year_month_weekday_last___) `constexpr year_month_weekday_last operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept; ` [9](#ymwdlast.nonmembers-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7867) *Returns*: ymwdl + dy[.](#ymwdlast.nonmembers-9.sentence-1) [🔗](#lib:operator-,year_month_weekday_last_) `constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept; ` [10](#ymwdlast.nonmembers-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7879) *Returns*: ymwdl + (-dy)[.](#ymwdlast.nonmembers-10.sentence-1) [🔗](#lib:operator%3c%3c,year_month_weekday_last) `template basic_ostream& operator<<(basic_ostream& os, const year_month_weekday_last& ymwdl); ` [11](#ymwdlast.nonmembers-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7892) *Effects*: Equivalent to:return os << format(os.getloc(), *STATICALLY-WIDEN*("{}/{:L}/{:L}"), ymwdl.year(), ymwdl.month(), ymwdl.weekday_last()); ### [30.8.18](#operators) Conventional syntax operators [[time.cal.operators]](time.cal.operators) [1](#operators-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7904) A set of overloaded operator/ functions provides a conventional syntax for the creation of civil calendar dates[.](#operators-1.sentence-1) [2](#operators-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7908) [*Note [1](#operators-note-1)*: The year, month, and day are accepted in any of the following 3 orders:*year*/*month*/*day**month*/*day*/*year**day*/*month*/*year* Anywhere a *day* is needed, any of the following can also be specified:last*weekday*[*i*]*weekday*[last] — *end note*] [3](#operators-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7925) [*Note [2](#operators-note-2)*: Partial-date types such as year_month and month_day can be created by not applying the second division operator for any of the three orders[.](#operators-3.sentence-1) For example:year_month ym = 2015y/April; month_day md1 = April/4; month_day md2 = 4d/April; — *end note*] [4](#operators-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7937) [*Example [1](#operators-example-1)*: auto a = 2015/4/4; // a == int(125)auto b = 2015y/4/4; // b == year_month_day{year(2015), month(4), day(4)}auto c = 2015y/4d/April; // error: no viable operator/ for first /auto d = 2015/April/4; // error: no viable operator/ for first / — *end example*] [🔗](#operators-itemdecl:1) `constexpr year_month operator/(const year& y, const month& m) noexcept; ` [5](#operators-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7953) *Returns*: {y, m}[.](#operators-5.sentence-1) [🔗](#operators-itemdecl:2) `constexpr year_month operator/(const year& y, int m) noexcept; ` [6](#operators-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7964) *Returns*: y / month(m)[.](#operators-6.sentence-1) [🔗](#operators-itemdecl:3) `constexpr month_day operator/(const month& m, const day& d) noexcept; ` [7](#operators-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7975) *Returns*: {m, d}[.](#operators-7.sentence-1) [🔗](#operators-itemdecl:4) `constexpr month_day operator/(const month& m, int d) noexcept; ` [8](#operators-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7986) *Returns*: m / day(d)[.](#operators-8.sentence-1) [🔗](#operators-itemdecl:5) `constexpr month_day operator/(int m, const day& d) noexcept; ` [9](#operators-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L7997) *Returns*: month(m) / d[.](#operators-9.sentence-1) [🔗](#operators-itemdecl:6) `constexpr month_day operator/(const day& d, const month& m) noexcept; ` [10](#operators-10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8008) *Returns*: m / d[.](#operators-10.sentence-1) [🔗](#operators-itemdecl:7) `constexpr month_day operator/(const day& d, int m) noexcept; ` [11](#operators-11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8019) *Returns*: month(m) / d[.](#operators-11.sentence-1) [🔗](#operators-itemdecl:8) `constexpr month_day_last operator/(const month& m, last_spec) noexcept; ` [12](#operators-12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8030) *Returns*: month_day_last{m}[.](#operators-12.sentence-1) [🔗](#operators-itemdecl:9) `constexpr month_day_last operator/(int m, last_spec) noexcept; ` [13](#operators-13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8041) *Returns*: month(m) / last[.](#operators-13.sentence-1) [🔗](#operators-itemdecl:10) `constexpr month_day_last operator/(last_spec, const month& m) noexcept; ` [14](#operators-14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8052) *Returns*: m / last[.](#operators-14.sentence-1) [🔗](#operators-itemdecl:11) `constexpr month_day_last operator/(last_spec, int m) noexcept; ` [15](#operators-15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8063) *Returns*: month(m) / last[.](#operators-15.sentence-1) [🔗](#operators-itemdecl:12) `constexpr month_weekday operator/(const month& m, const weekday_indexed& wdi) noexcept; ` [16](#operators-16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8074) *Returns*: {m, wdi}[.](#operators-16.sentence-1) [🔗](#operators-itemdecl:13) `constexpr month_weekday operator/(int m, const weekday_indexed& wdi) noexcept; ` [17](#operators-17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8085) *Returns*: month(m) / wdi[.](#operators-17.sentence-1) [🔗](#operators-itemdecl:14) `constexpr month_weekday operator/(const weekday_indexed& wdi, const month& m) noexcept; ` [18](#operators-18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8096) *Returns*: m / wdi[.](#operators-18.sentence-1) [🔗](#operators-itemdecl:15) `constexpr month_weekday operator/(const weekday_indexed& wdi, int m) noexcept; ` [19](#operators-19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8107) *Returns*: month(m) / wdi[.](#operators-19.sentence-1) [🔗](#operators-itemdecl:16) `constexpr month_weekday_last operator/(const month& m, const weekday_last& wdl) noexcept; ` [20](#operators-20) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8118) *Returns*: {m, wdl}[.](#operators-20.sentence-1) [🔗](#operators-itemdecl:17) `constexpr month_weekday_last operator/(int m, const weekday_last& wdl) noexcept; ` [21](#operators-21) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8129) *Returns*: month(m) / wdl[.](#operators-21.sentence-1) [🔗](#operators-itemdecl:18) `constexpr month_weekday_last operator/(const weekday_last& wdl, const month& m) noexcept; ` [22](#operators-22) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8140) *Returns*: m / wdl[.](#operators-22.sentence-1) [🔗](#operators-itemdecl:19) `constexpr month_weekday_last operator/(const weekday_last& wdl, int m) noexcept; ` [23](#operators-23) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8151) *Returns*: month(m) / wdl[.](#operators-23.sentence-1) [🔗](#operators-itemdecl:20) `constexpr year_month_day operator/(const year_month& ym, const day& d) noexcept; ` [24](#operators-24) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8162) *Returns*: {ym.year(), ym.month(), d}[.](#operators-24.sentence-1) [🔗](#operators-itemdecl:21) `constexpr year_month_day operator/(const year_month& ym, int d) noexcept; ` [25](#operators-25) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8173) *Returns*: ym / day(d)[.](#operators-25.sentence-1) [🔗](#operators-itemdecl:22) `constexpr year_month_day operator/(const year& y, const month_day& md) noexcept; ` [26](#operators-26) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8184) *Returns*: y / md.month() / md.day()[.](#operators-26.sentence-1) [🔗](#operators-itemdecl:23) `constexpr year_month_day operator/(int y, const month_day& md) noexcept; ` [27](#operators-27) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8195) *Returns*: year(y) / md[.](#operators-27.sentence-1) [🔗](#operators-itemdecl:24) `constexpr year_month_day operator/(const month_day& md, const year& y) noexcept; ` [28](#operators-28) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8206) *Returns*: y / md[.](#operators-28.sentence-1) [🔗](#operators-itemdecl:25) `constexpr year_month_day operator/(const month_day& md, int y) noexcept; ` [29](#operators-29) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8217) *Returns*: year(y) / md[.](#operators-29.sentence-1) [🔗](#operators-itemdecl:26) `constexpr year_month_day_last operator/(const year_month& ym, last_spec) noexcept; ` [30](#operators-30) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8228) *Returns*: {ym.year(), month_day_last{ym.month()}}[.](#operators-30.sentence-1) [🔗](#operators-itemdecl:27) `constexpr year_month_day_last operator/(const year& y, const month_day_last& mdl) noexcept; ` [31](#operators-31) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8239) *Returns*: {y, mdl}[.](#operators-31.sentence-1) [🔗](#operators-itemdecl:28) `constexpr year_month_day_last operator/(int y, const month_day_last& mdl) noexcept; ` [32](#operators-32) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8250) *Returns*: year(y) / mdl[.](#operators-32.sentence-1) [🔗](#operators-itemdecl:29) `constexpr year_month_day_last operator/(const month_day_last& mdl, const year& y) noexcept; ` [33](#operators-33) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8261) *Returns*: y / mdl[.](#operators-33.sentence-1) [🔗](#operators-itemdecl:30) `constexpr year_month_day_last operator/(const month_day_last& mdl, int y) noexcept; ` [34](#operators-34) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8272) *Returns*: year(y) / mdl[.](#operators-34.sentence-1) [🔗](#operators-itemdecl:31) `constexpr year_month_weekday operator/(const year_month& ym, const weekday_indexed& wdi) noexcept; ` [35](#operators-35) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8283) *Returns*: {ym.year(), ym.month(), wdi}[.](#operators-35.sentence-1) [🔗](#operators-itemdecl:32) `constexpr year_month_weekday operator/(const year& y, const month_weekday& mwd) noexcept; ` [36](#operators-36) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8294) *Returns*: {y, mwd.month(), mwd.weekday_indexed()}[.](#operators-36.sentence-1) [🔗](#operators-itemdecl:33) `constexpr year_month_weekday operator/(int y, const month_weekday& mwd) noexcept; ` [37](#operators-37) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8305) *Returns*: year(y) / mwd[.](#operators-37.sentence-1) [🔗](#operators-itemdecl:34) `constexpr year_month_weekday operator/(const month_weekday& mwd, const year& y) noexcept; ` [38](#operators-38) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8316) *Returns*: y / mwd[.](#operators-38.sentence-1) [🔗](#operators-itemdecl:35) `constexpr year_month_weekday operator/(const month_weekday& mwd, int y) noexcept; ` [39](#operators-39) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8327) *Returns*: year(y) / mwd[.](#operators-39.sentence-1) [🔗](#operators-itemdecl:36) `constexpr year_month_weekday_last operator/(const year_month& ym, const weekday_last& wdl) noexcept; ` [40](#operators-40) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8338) *Returns*: {ym.year(), ym.month(), wdl}[.](#operators-40.sentence-1) [🔗](#operators-itemdecl:37) `constexpr year_month_weekday_last operator/(const year& y, const month_weekday_last& mwdl) noexcept; ` [41](#operators-41) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8349) *Returns*: {y, mwdl.month(), mwdl.weekday_last()}[.](#operators-41.sentence-1) [🔗](#operators-itemdecl:38) `constexpr year_month_weekday_last operator/(int y, const month_weekday_last& mwdl) noexcept; ` [42](#operators-42) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8360) *Returns*: year(y) / mwdl[.](#operators-42.sentence-1) [🔗](#operators-itemdecl:39) `constexpr year_month_weekday_last operator/(const month_weekday_last& mwdl, const year& y) noexcept; ` [43](#operators-43) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8371) *Returns*: y / mwdl[.](#operators-43.sentence-1) [🔗](#operators-itemdecl:40) `constexpr year_month_weekday_last operator/(const month_weekday_last& mwdl, int y) noexcept; ` [44](#operators-44) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/time.tex#L8382) *Returns*: year(y) / mwdl[.](#operators-44.sentence-1)