Scroll to navigation

std::chrono::year_month(3) C++ Standard Libary std::chrono::year_month(3)

NAME

std::chrono::year_month - std::chrono::year_month

Synopsis


Defined in header <chrono>
class year_month; (since C++20)


The class year_month represents a specific month of a specific year, but with an
unspecified day. It is a field-based time point, with a resolution of
std::chrono::months.


year_month is a TriviallyCopyable StandardLayoutType.

Member functions


constructor constructs a year_month
(public member function)
year accesses the stored year and month
month (public member function)
operator+= modifies the year_month by some number of months or years
operator-= (public member function)
ok checks if this year_month is valid
(public member function)


Nonmember functions


operator== compares two year_month values
operator<=> (function)
(C++20)
operator+ performs arithmetic on year_month
operator- (function)
(C++20)
operator<< outputs a year_month into a stream
(C++20) (function template)
from_stream parses a year_month from a stream according to the provided format
(C++20) (function template)

Helper classes


specialization of std::formatter that
std::formatter<std::chrono::year_month> formats a year_month according to the
(C++20) provided format
(class template specialization)

2022.07.31 http://cppreference.com