Calendar Dates

Learn how to create and display calendar dates.

A new type of the chrono extension in C++20 is a calendar date. C++20 supports various ways to create a calendar date and interact with them. First of all: What is a calendar date?

  • A calendar date is a date that consists of a year, a month, and a day. Consequently, C++20 has a specific data type std::chrono::year_month_day. C++20 has way more to offer. The following table should give you the first overview of calendar-date types before I show you various use-cases.
Type Description
std::chrono::last_spec Indicates the last day or weekday of a month
std::chrono::day Represents a day of a month
std::chrono::month Represents a month of a year
std::chrono::year Represents a year in the Gregorian calendar
std::chrono::weekday Represents a
...