[time.cal.day.nonmembers]

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

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

### 30.8.3 Class day [[time.cal.day]](time.cal.day#nonmembers)

#### 30.8.3.3 Non-member functions [time.cal.day.nonmembers]

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

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

[1](#1)

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

*Returns*: unsigned{x} == unsigned{y}[.](#1.sentence-1)

[ð](#lib:operator%3c=%3e,day)

`constexpr strong_ordering operator<=>(const day& x, const day& y) noexcept;
`

[2](#2)

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

*Returns*: unsigned{x} <=> unsigned{y}[.](#2.sentence-1)

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

`constexpr day operator+(const day& x, const days& y) noexcept;
`

[3](#3)

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

*Returns*: day(unsigned{x} + y.count())[.](#3.sentence-1)

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

`constexpr day operator+(const days& x, const day& y) noexcept;
`

[4](#4)

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

*Returns*: y + x[.](#4.sentence-1)

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

`constexpr day operator-(const day& x, const days& y) noexcept;
`

[5](#5)

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

*Returns*: x + -y[.](#5.sentence-1)

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

`constexpr days operator-(const day& x, const day& y) noexcept;
`

[6](#6)

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

*Returns*: days{int(unsigned{x}) - int(unsigned{y})}[.](#6.sentence-1)

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

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

[7](#7)

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

*Effects*: Equivalent to:return os << (d.ok() ? format(*STATICALLY-WIDEN*<charT>("{:%d}"), d) : format(*STATICALLY-WIDEN*<charT>("{:%d} is not a valid day"), d));

[ð](#lib:from_stream,day)

`template<class charT, class traits, class Alloc = allocator<charT>>
  basic_istream<charT, traits>&
    from_stream(basic_istream<charT, traits>& is, const charT* fmt,
                day& d, basic_string<charT, traits, Alloc>* abbrev = nullptr,
                minutes* offset = nullptr);
`

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

If the parse fails to decode a valid day,is.setstate(ios_base​::​failbit) is called andd is not modified[.](#8.sentence-2)

If %Z is used and successfully parsed,
that value will be assigned to *abbrev if abbrev is non-null[.](#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[.](#8.sentence-4)

[9](#9)

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

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

[ð](#lib:operator%22%22d,day)

`constexpr chrono::day operator""d(unsigned long long d) noexcept;
`

[10](#10)

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

*Returns*: day{static_cast<unsigned>(d)}[.](#10.sentence-1)
