CONZEPT 16 C++ API
|
Period of time covering a day. More...
#include "C16/Value/Date.hpp"
Period of time covering a day.
Static Public Attributes | |
static const int | YEAR_EPOCH = 1900 |
Epoch year of dates. More... | |
static const int | YEAR_MINIMUM = 1900 |
Minimum year of a date. More... | |
static const int | YEAR_MAXIMUM = 2154 |
Maximum year of a date. More... | |
static const Date | EMPTY |
Empty date (0000-00-00). More... | |
static const Date | MINIMUM |
Minimum date (1900-01-01). More... | |
static const Date | MAXIMUM |
Maximum date (2154-12-31). More... | |
Static Public Member Functions | |
static Date | now () |
Gets the current date (UTC) of the system. More... | |
static Date | now_local () |
Gets the current date of the local timezone of the system. More... | |
static bool | leap_year (int year) |
Gets if a year is a leap year. More... | |
static int | days_in_month (int year, int month) |
Gets the days in a month. More... | |
static bool | validate (int year, int month, int day) |
Validates a date by means of its year, month and day (of the month). More... | |
static bool | validate (long int serial) |
Validates a date by means of its serial in units of days since the epoch. More... | |
static void | validate_throw (int year, int month, int day) |
Validates a date by means of its year, month and day (of the month). More... | |
static void | validate_throw (long int serial) |
Validates a date by means of its serial in units of days since the epoch. More... | |
Public Member Functions | |
Date () | |
Constructs an empty date. More... | |
Date (int year, int month, int day) | |
Constructs a date by means of its year, month and day (of the month). More... | |
Date (long int serial) | |
Constructs a date by means of a serial in units of days since the epoch. More... | |
Date (const Date &other) | |
Constructs a date by copying another date. More... | |
Date & | operator= (const Date &other) |
Assigns the date from another date. More... | |
int | compare (const Date &other) const |
Compares the date with another date. More... | |
bool | operator== (const Date &other) const |
Gets if the date is equal to another date. More... | |
bool | operator!= (const Date &other) const |
Gets if the date is unequal to another date. More... | |
bool | operator< (const Date &other) const |
Gets if the date is earlier than another date. More... | |
bool | operator<= (const Date &other) const |
Gets if the date is equal to or earlier than another date. More... | |
bool | operator>= (const Date &other) const |
Gets if the date is equal to or later than another date. More... | |
bool | operator> (const Date &other) const |
Gets if the date is later than another date. More... | |
bool | empty () const |
Gets if the date is empty. More... | |
int | year () const |
Gets the year of the date. More... | |
int | month () const |
Gets the month of the date. More... | |
int | day () const |
Gets the day (of the month) of the date. More... | |
int | day_of_year () const |
Gets the day of the year of the date. More... | |
int | day_of_week () const |
Gets the day of the week of the date. More... | |
int | week () const |
Gets the week (according to ISO 8601) of the date. More... | |
int | week_year () const |
Gets the year of the week (according to ISO 8601) of the date. More... | |
bool | leap_year () const |
Gets if the date lies in a leap year. More... | |
long int | serial () const |
Gets the serial of the date in units of days since the epoch. More... | |
void | clear () |
Empties the date. More... | |
void | assign (int year, int month, int day) |
Assigns the date by means of its year, month and day (of the month). More... | |
void | assign (long int serial) |
Assigns the date by means of its serial in units of days since the epoch. More... | |
|
static |
Epoch year of dates.
|
static |
Minimum year of a date.
|
static |
Maximum year of a date.
|
static |
Empty date (0000-00-00).
|
static |
Minimum date (1900-01-01).
|
static |
Maximum date (2154-12-31).
C16::Value::Date::Date | ( | ) |
Constructs an empty date.
C16::Value::Date::Date | ( | int | year, |
int | month, | ||
int | day | ||
) |
Constructs a date by means of its year, month and day (of the month).
year | Year of the date (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the date (1 to 12) |
day | Day (of the month) of the date (1 to days_in_month) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
Exception::Invalidity | Day invalid. |
|
explicit |
Constructs a date by means of a serial in units of days since the epoch.
Exception::Invalidity | Serial invalid. |
C16::Value::Date::Date | ( | const Date & | other | ) |
Constructs a date by copying another date.
other | Another date |
|
static |
Gets the current date (UTC) of the system.
Exception::Invalidity | Year invalid. Year of current date (UTC) of the system is an invalid year of date (YEAR_MINIMUM to YEAR_MAXIMUM). |
|
static |
Gets the current date of the local timezone of the system.
Exception::Invalidity | Year invalid. Year of current date of the local timezone of the system is an invalid year of date (YEAR_MINIMUM to YEAR_MAXIMUM). |
|
static |
Gets if a year is a leap year.
year | Year (YEAR_MINIMUM to YEAR_MAXIMUM) |
Exception::Invalidity | Year invalid. |
|
static |
Gets the days in a month.
year | Year of the month (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month (1 to 12) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
|
static |
Validates a date by means of its year, month and day (of the month).
year | Year of the date (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the date (1 to 12) |
day | Day (of the month) of the date (1 to days_in_month) |
|
static |
|
static |
Validates a date by means of its year, month and day (of the month).
year | Year of the date (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the date (1 to 12) |
day | Day (of the month) of the date (1 to days_in_month) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
Exception::Invalidity | Day invalid. |
|
static |
Validates a date by means of its serial in units of days since the epoch.
Exception::Invalidity | Serial invalid. |
Assigns the date from another date.
other | Another date |
int C16::Value::Date::compare | ( | const Date & | other | ) | const |
Compares the date with another date.
other | Another date |
0 | The date is equal to the other date. |
< 0 | The date is earlier than the other date. |
> 0 | The date is later than the other date. |
bool C16::Value::Date::operator== | ( | const Date & | other | ) | const |
Gets if the date is equal to another date.
other | Another date |
bool C16::Value::Date::operator!= | ( | const Date & | other | ) | const |
Gets if the date is unequal to another date.
other | Another date |
bool C16::Value::Date::operator< | ( | const Date & | other | ) | const |
Gets if the date is earlier than another date.
other | Another date |
bool C16::Value::Date::operator<= | ( | const Date & | other | ) | const |
Gets if the date is equal to or earlier than another date.
other | Another date |
bool C16::Value::Date::operator>= | ( | const Date & | other | ) | const |
Gets if the date is equal to or later than another date.
other | Another date |
bool C16::Value::Date::operator> | ( | const Date & | other | ) | const |
Gets if the date is later than another date.
other | Another date |
bool C16::Value::Date::empty | ( | ) | const |
Gets if the date is empty.
int C16::Value::Date::year | ( | ) | const |
Gets the year of the date.
0 | Date empty. |
int C16::Value::Date::month | ( | ) | const |
Gets the month of the date.
0 | Date empty. |
int C16::Value::Date::day | ( | ) | const |
Gets the day (of the month) of the date.
0 | Date empty. |
int C16::Value::Date::day_of_year | ( | ) | const |
Gets the day of the year of the date.
0 | Date empty. |
int C16::Value::Date::day_of_week | ( | ) | const |
Gets the day of the week of the date.
0 | Date empty. |
1 | Monday |
2 | Tuesday |
3 | Wednesday |
4 | Thursday |
5 | Friday |
6 | Saturday |
7 | Sunday |
int C16::Value::Date::week | ( | ) | const |
Gets the week (according to ISO 8601) of the date.
0 | Date empty. |
int C16::Value::Date::week_year | ( | ) | const |
Gets the year of the week (according to ISO 8601) of the date.
0 | Date empty. |
bool C16::Value::Date::leap_year | ( | ) | const |
Gets if the date lies in a leap year.
false
if empty. long int C16::Value::Date::serial | ( | ) | const |
void C16::Value::Date::clear | ( | ) |
Empties the date.
void C16::Value::Date::assign | ( | int | year, |
int | month, | ||
int | day | ||
) |
Assigns the date by means of its year, month and day (of the month).
year | Year of the date (YEAR_MINIMUM to YEAR_MAXIMUM) |
month | Month of the date (1 to 12) |
day | Day (of the month) of the date (1 to days_in_month) |
Exception::Invalidity | Year invalid. |
Exception::Invalidity | Month invalid. |
Exception::Invalidity | Day invalid. |
void C16::Value::Date::assign | ( | long int | serial | ) |
Assigns the date by means of its serial in units of days since the epoch.
Exception::Invalidity | Serial invalid. |