tntdb
1.2
|
This class holds a date. More...
#include <date.h>
Public Member Functions | |
Date () | |
Initializes the Date-object with empty values. | |
Date (unsigned short year_, unsigned short month_, unsigned short day_) | |
Initializes the date-object with the given values. | |
unsigned short | getYear () const |
Returns the year-part of the Date. | |
unsigned short | getMonth () const |
Returns the month-part of the Date. | |
unsigned short | getDay () const |
Returns the day-part of the Date. | |
unsigned short | getWDay () const |
Returns the day of week of the Date (0=sunday to 6=saturday). | |
bool | isNull () const |
void | set (unsigned short year_, unsigned short month_, unsigned short day_) |
sets the date. | |
std::string | getIso () const |
returns the date in ISO-format (yyyy-mm-dd) | |
bool | operator== (const Date &dt) const |
bool | operator!= (const Date &dt) const |
bool | operator< (const Date &dt) const |
bool | operator> (const Date &dt) const |
bool | operator<= (const Date &dt) const |
bool | operator>= (const Date &dt) const |
Static Public Member Functions | |
static Date | localtime () |
static Date | gmtime () |
static Date | fromIso (const std::string &s) |
interprets the passed string as a date-string in ISO-format (yyyy-mm-dd) and returns a Date-object. |
This class holds a date.
tntdb::Date::Date | ( | ) | [inline] |
Initializes the Date-object with empty values.
tntdb::Date::Date | ( | unsigned short | year_, |
unsigned short | month_, | ||
unsigned short | day_ | ||
) | [inline] |
Initializes the date-object with the given values.
No range-checks are done.
static Date tntdb::Date::fromIso | ( | const std::string & | s | ) | [static] |
interprets the passed string as a date-string in ISO-format (yyyy-mm-dd) and returns a Date-object.
When the string is not in ISO-format, a exception of type tntdb::TypeError is thrown.
unsigned short tntdb::Date::getDay | ( | ) | const [inline] |
Returns the day-part of the Date.
std::string tntdb::Date::getIso | ( | ) | const |
returns the date in ISO-format (yyyy-mm-dd)
unsigned short tntdb::Date::getMonth | ( | ) | const [inline] |
Returns the month-part of the Date.
unsigned short tntdb::Date::getWDay | ( | ) | const |
Returns the day of week of the Date (0=sunday to 6=saturday).
unsigned short tntdb::Date::getYear | ( | ) | const [inline] |
Returns the year-part of the Date.
void tntdb::Date::set | ( | unsigned short | year_, |
unsigned short | month_, | ||
unsigned short | day_ | ||
) | [inline] |
sets the date.