#include <tntdb/cxxtools/datetime.h>
Public Member Functions | |
| DateTime (int year, unsigned month, unsigned day, unsigned hour=0, unsigned minute=0, unsigned second=0, unsigned msec=0) | |
| DateTime (const DateTime &dateTime) | |
| DateTime & | operator= (const DateTime &dateTime) |
| DateTime & | operator= (unsigned julianDay) |
| void | set (int year, unsigned month, unsigned day, unsigned hour=0, unsigned min=0, unsigned sec=0, unsigned msec=0) |
| void | get (int &year, unsigned &month, unsigned &day, unsigned &hour, unsigned &min, unsigned &sec, unsigned &msec) const |
| const Date & | date () const |
| const Date & | date () |
| DateTime & | setDate (const Date &date) |
| const Time & | time () const |
| const Time & | time () |
| DateTime & | setTime (const Time &time) |
| unsigned | day () const |
| Returns the day-part of the date. | |
| unsigned | month () const |
| Returns the month-part of the date. | |
| int | year () const |
| Returns the year-part of the date. | |
| unsigned | hour () const |
| Returns the hour-part of the Time. | |
| unsigned | minute () const |
| Returns the minute-part of the Time. | |
| unsigned | second () const |
| Returns the second-part of the Time. | |
| unsigned | msec () const |
| Returns the millisecond-part of the Time. | |
| int64_t | msecsSinceEpoch () const |
| Returns the milliseconds relative to the Unix-epoch. | |
| std::string | toIsoString () const |
| bool | operator== (const DateTime &rhs) const |
| bool | operator!= (const DateTime &rhs) const |
| DateTime & | operator+= (const Timespan &ts) |
| Assignment by sum operator. | |
| DateTime & | operator-= (const Timespan &ts) |
| Assignment by difference operator. | |
| bool | operator< (const DateTime &dt) const |
| bool | operator<= (const DateTime &dt) const |
| bool | operator> (const DateTime &dt) const |
| bool | operator>= (const DateTime &dt) const |
Static Public Member Functions | |
| static DateTime | fromJulianDays (unsigned julianDays) |
| static DateTime | fromMSecsSinceEpoch (const int64_t msecsSinceEpoch) |
| Creates a DateTime object relative to the Unix epoch. | |
| static DateTime | fromIsoString (const std::string &s) |
| static bool | isValid (int year, unsigned month, unsigned day, unsigned hour, unsigned minute, unsigned second, unsigned msec) |
Friends | |
| Timespan | operator- (const DateTime &first, const DateTime &second) |
| DateTime | operator+ (const DateTime &dt, const Timespan &ts) |
| DateTime | operator- (const DateTime &dt, const Timespan &ts) |
| static DateTime fromMSecsSinceEpoch | ( | const int64_t | msecsSinceEpoch | ) | [static] |
The DateTime will be relative to the unix-epoch (Jan 1st 1970) by the milli-seconds specified by msecsSinceEpoch. The construction does not take care of any time zones. I.e. the milliseconds will be treated as if they were in the same time zone as the reference (January 1st 1970). Thus specifying a "time-zoned" millisecond value will lead to a "time-zoned" DateTime. And accordingly a "GMT" millisecond value will lead to a "GMT" DateTime.
| int64_t msecsSinceEpoch | ( | ) | const |
The calculation does currently not take care of any time zones. I.e. the milliseconds will be calculated as if they were in the same time zone as the reference (January 1st 1970). Thus calling this API on a "time-zoned" DateTime will lead to a "time-zoned" millisecond value. And accordingly calling this API on a "GMT" DateTime will lead to a "GMT" millisecond value.