|
| date (const date &other) |
| Copy constructor.
|
|
| date (const char *date_str) |
| Constructor. Requires unambiguous date string (e.g. yyyy-mm-dd, yyyy/mm/dd, yyyy.mm.dd)
|
|
| date (const variant &variant) |
| Constructor. May throw exception if variant cannot be converted to a date.
|
|
| date (uint32_t yyyymmdd=date::undefined) |
| Constructor. By default, self is not initialized; defined() will return false. Use the date::now argument to initialize to the current system date. Otherwise initialize to any other date by submitting a valid yyyymmdd argument. More...
|
|
| date (int year, int month, int day) |
| Constructor taking year, month, and day arguments.
|
|
void | assign (const date &, bool _error_on_undefined=true) |
| Assigns a given date to self. Throws an exception if given date is not defined (see defined()) and _error_on_undefined flag is true.
|
|
void | clear (void) |
| Sets self to an 'undefined' state, where defined() will return false.
|
|
int | day_of_month (void) const |
| Returns the day of the month (1-31).
|
|
week_day | day_of_week (void) const |
| Returns the day of the week (Sunday = 0, Saturday = 6).
|
|
int | day_of_year (void) const |
| Returns the day of the year (1-366).
|
|
void | decr (int num_days) |
| Decrements self by num_days.
|
|
void | decr_to_prev_weekday (void) |
| Decrements self to previous weekday, skipping sundays or saturdays.
|
|
bool | defined (void) const |
| Returns true if self is not 'null'; in other words, the date was defined.
|
|
bool | in_leap_year (void) const |
| Returns true if the date's year is a leap year.
|
|
void | incr (int num_days) |
| Increments self by num_days.
|
|
void | incr_to_next_weekday (void) |
| Increments self to next weekday, skipping sundays and saturdays.
|
|
bool | is_weekend (void) const |
| Returns true if current day of week is either Saturday or Sunday.
|
|
void | julian_day (int julian_day) |
| Resets the internal julian-day value.
|
|
int | julian_day (void) const |
| Returns the julian-day.
|
|
int | month (void) const |
| Returns the month (1-12).
|
|
bool | operator!= (const date &other) const |
| Returns true if self is not equal to other.
|
|
void | operator+= (const duration &num_days) |
| Adds a given number of days to self. The given duration must not have an intraday component.
|
|
void | operator-= (const duration &num_days) |
| Subtracts a given number of days from self. The given duration must not have an intraday component.
|
|
bool | operator< (const date &other) const |
| Returns true if self is smaller than other.
|
|
bool | operator<= (const date &other) const |
| Returns true if self is smaller or equal to other.
|
|
date & | operator= (const date &other) |
| Assignment operator.
|
|
bool | operator== (const date &other) const |
| Returns true if self is equal to other.
|
|
bool | operator> (const date &other) const |
| Returns true if self is larger than other.
|
|
bool | operator>= (const date &other) const |
| Returns true if self is larger or equal to other.
|
|
void | set (uint32_t year, uint32_t month, uint32_t day) |
| Sets self to given year, month, day combination.
|
|
void | set_from_iso_string (const std::string &iso_date_string) |
| Sets the date from the given ISO date string with format: "yyyy-mm-dd". This member function is much faster then the one declaring a format parameter. More...
|
|
void | set_from_string (const std::string &date_string, const char *format_string="") |
| Sets the date from the given date_string interpreted according to given format_string. More...
|
|
void | set_to_now (tsa::local_or_utc_time_select lu) |
| Sets self to the operating system's current date.
|
|
std::string | to_string (const char *format) const |
| Returns the date as a string formated according to given format. More...
|
|
std::string | to_string (void) const |
| Returns the date as an ISO date string (yyyy-mm-dd).
|
|
int | year (void) const |
| Returns the year.
|
|
void | yyyymmdd (uint32_t yyyymmdd) |
| Sets the date from an integer in yyyymmdd format such as 19990403 (representing April 3 1999).
|
|
uint32_t | yyyymmdd (void) const |
| Returns the current date as a number.
|
|
A date of the Gregorian calendar.
Date manipulation algorithms are accurate from the year 1753 onwards in accordance with the Gregorian Calendar. The class represents a continuous day sequence from the year 100 AD onwards. A date instance always represents a valid date. Any errors will result in an exception.