A date, decomposed into its components.
More...
#include <xentara/utils/chrono/DecomposedDate.hpp>
|
constexpr | DecomposedDate () noexcept=default |
| Default constructor.
|
|
| DecomposedDate (std::chrono::sys_days date) noexcept |
| Constructor for an arbitrary date.
|
|
constexpr auto | year () const noexcept -> int |
| Gets the calendar year.
|
|
constexpr auto | month () const noexcept -> unsigned int |
| Gets the calendar month.
|
|
constexpr auto | day () const noexcept -> unsigned int |
| Gets the day of the month.
|
|
A date, decomposed into its components.
This class uses the so called “proleptic Gregorian calendar”, which is the Gregorian calendar extended to dates before October 15, 1582.
◆ DecomposedDate() [1/2]
constexpr xentara::utils::chrono::DecomposedDate::DecomposedDate |
( |
| ) |
|
|
constexprdefaultnoexcept |
Default constructor.
This constructor constructs a time point corresponding to 2001-01-01.
◆ DecomposedDate() [2/2]
xentara::utils::chrono::DecomposedDate::DecomposedDate |
( |
std::chrono::sys_days |
date | ) |
|
|
noexcept |
Constructor for an arbitrary date.
- Parameters
-
date | The date, represented as number of days since the UNIX Epoch (1970-01-01 00:00:00 UTC). Can be 0, or negative to represent dates before 1970. |
◆ day()
constexpr auto xentara::utils::chrono::DecomposedDate::day |
( |
| ) |
const -> unsigned int
|
|
constexprnoexcept |
Gets the day of the month.
- Returns
- The day of the month, between 1 and 31
◆ month()
constexpr auto xentara::utils::chrono::DecomposedDate::month |
( |
| ) |
const -> unsigned int
|
|
constexprnoexcept |
Gets the calendar month.
- Returns
- The month number, between 1 and 12
◆ year()
constexpr auto xentara::utils::chrono::DecomposedDate::year |
( |
| ) |
const -> int
|
|
constexprnoexcept |
Gets the calendar year.
- Returns
- The year in the proleptic Gregorian calendar. The value can be 0 or negative to represent years before the year 1 AD. 0 represents the year 1 B.C., 1 represents the year 2 B.C., etc.
- Note
- Please note that there is no “year 0”. The year 1 BC immediately precedes the year 1 AD in both the Gregorian and the Julian calendar.