[time.cal.wd.members]

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

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

### 30.8.6 Class weekday [[time.cal.wd]](time.cal.wd#members)

#### 30.8.6.2 Member functions [time.cal.wd.members]

[ð](#lib:weekday,constructor)

`constexpr explicit weekday(unsigned wd) noexcept;
`

[1](#1)

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

*Effects*: Initializes wd_ with wd == 7 ? 0 : wd[.](#1.sentence-1)

The value held is unspecified if wd is not in the range [0, 255][.](#1.sentence-2)

[ð](#lib:weekday,constructor_)

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

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

[3](#3)

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

[*Example [1](#example-1)*:

If dp represents 1970-01-01,
the constructed weekday represents Thursday
by storing 4 in wd_[.](#3.sentence-1)

â *end example*]

[ð](#lib:weekday,constructor__)

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

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

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

[ð](#lib:operator++,weekday)

`constexpr weekday& operator++() noexcept;
`

[6](#6)

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

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

[7](#7)

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

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

[ð](#lib:operator++,weekday_)

`constexpr weekday operator++(int) noexcept;
`

[8](#8)

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

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

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

[ð](#lib:operator--,weekday)

`constexpr weekday& operator--() noexcept;
`

[10](#10)

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

*Effects*: *this -= days{1}[.](#10.sentence-1)

[11](#11)

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

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

[ð](#lib:operator--,weekday_)

`constexpr weekday operator--(int) noexcept;
`

[12](#12)

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

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

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

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

`constexpr weekday& operator+=(const days& d) noexcept;
`

[14](#14)

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

*Effects*: *this = *this + d[.](#14.sentence-1)

[15](#15)

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

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

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

`constexpr weekday& operator-=(const days& d) noexcept;
`

[16](#16)

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

*Effects*: *this = *this - d[.](#16.sentence-1)

[17](#17)

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

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

[ð](#lib:c_encoding,weekday)

`constexpr unsigned c_encoding() const noexcept;
`

[18](#18)

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

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

[ð](#lib:iso_encoding,weekday)

`constexpr unsigned iso_encoding() const noexcept;
`

[19](#19)

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

*Returns*: wd_ == 0u ? 7u : wd_[.](#19.sentence-1)

[ð](#lib:ok,weekday)

`constexpr bool ok() const noexcept;
`

[20](#20)

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

*Returns*: wd_ <= 6[.](#20.sentence-1)

[ð](#lib:operator%5b%5d,weekday)

`constexpr weekday_indexed operator[](unsigned index) const noexcept;
`

[21](#21)

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

*Returns*: {*this, index}[.](#21.sentence-1)

[ð](#lib:operator%5b%5d,weekday_)

`constexpr weekday_last operator[](last_spec) const noexcept;
`

[22](#22)

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

*Returns*: weekday_last{*this}[.](#22.sentence-1)
