A date is a specific day specified in terms of a year, month, and day. It can also be initialized as a number of days since a base date using date::from_number. IMPORTANT: The date could be in an empty/invalid state, so you may want to call is_null() before calling any functions!
More...
#include <date.hpp>
|
| date (int year_, int month_, int day_) |
| Constructs a date from a given year, month, and day. More...
|
|
| date ()=default |
| Constructs an empty date (a call to is_null() will return true). More...
|
|
int | to_number (calendar base_date) const |
| Returns the number of days between this date and base_date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown. More...
|
|
int | weekday () const |
| Calculates and returns the day of the week that this date represents in the range 0 to 6 where 0 represents Sunday. Returns -1 if the weekday could not be determined. More...
|
|
int | get_year () const |
| Returns the year of the date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown. More...
|
|
int | get_month () const |
| Returns the month of the date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown. More...
|
|
int | get_day () const |
| Returns the day of the date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown. More...
|
|
bool | is_null () const |
| Returns whether the date is in an empty/invalid state. More...
|
|
bool | operator== (const date &comparand) const |
| Returns true if this date is equal to comparand. More...
|
|
bool | operator!= (const date &comparand) const |
| Returns true if this date is equal to comparand. More...
|
|
|
static date | today () |
| Returns the current date according to the system time. If the current date could not be determined, the date will be in an empty state (is_null() will return true). More...
|
|
static date | from_number (int days_since_base_year, calendar base_date) |
| Returns a date by adding days_since_base_year to base_date. This includes leap years. More...
|
|
|
int | year = 0 |
| –— TODO IMPORTANT: accessing the members directly is DEPRECATED and will be changed in a further release! Please use the getters instead! More...
|
|
int | month = 0 |
| The month More...
|
|
int | day = 0 |
| The day More...
|
|
A date is a specific day specified in terms of a year, month, and day. It can also be initialized as a number of days since a base date using date::from_number. IMPORTANT: The date could be in an empty/invalid state, so you may want to call is_null() before calling any functions!
◆ date() [1/2]
xlnt::date::date |
( |
int |
year_, |
|
|
int |
month_, |
|
|
int |
day_ |
|
) |
| |
Constructs a date from a given year, month, and day.
◆ date() [2/2]
Constructs an empty date (a call to is_null() will return true).
◆ from_number()
static date xlnt::date::from_number |
( |
int |
days_since_base_year, |
|
|
calendar |
base_date |
|
) |
| |
|
static |
Returns a date by adding days_since_base_year to base_date. This includes leap years.
◆ get_day()
int xlnt::date::get_day |
( |
| ) |
const |
Returns the day of the date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown.
◆ get_month()
int xlnt::date::get_month |
( |
| ) |
const |
Returns the month of the date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown.
◆ get_year()
int xlnt::date::get_year |
( |
| ) |
const |
Returns the year of the date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown.
◆ is_null()
bool xlnt::date::is_null |
( |
| ) |
const |
|
inline |
Returns whether the date is in an empty/invalid state.
◆ operator!=()
bool xlnt::date::operator!= |
( |
const date & |
comparand | ) |
const |
Returns true if this date is equal to comparand.
◆ operator==()
bool xlnt::date::operator== |
( |
const date & |
comparand | ) |
const |
Returns true if this date is equal to comparand.
◆ to_number()
int xlnt::date::to_number |
( |
calendar |
base_date | ) |
const |
Returns the number of days between this date and base_date. The date could be in an empty/invalid state, so you may want to call is_null() first! If this function is called when having an empty/invalid state, an xlnt::invalid_attribute exception will be thrown.
◆ today()
static date xlnt::date::today |
( |
| ) |
|
|
static |
Returns the current date according to the system time. If the current date could not be determined, the date will be in an empty state (is_null() will return true).
◆ weekday()
int xlnt::date::weekday |
( |
| ) |
const |
Calculates and returns the day of the week that this date represents in the range 0 to 6 where 0 represents Sunday. Returns -1 if the weekday could not be determined.
◆ day
◆ month
int xlnt::date::month = 0 |
◆ year
–— TODO IMPORTANT: accessing the members directly is DEPRECATED and will be changed in a further release! Please use the getters instead!
The year
The documentation for this struct was generated from the following file: