DateTime class.
Note: milliseconds default to 0 due to limited accuracy.
Type: Value type
Declaration | Description |
---|---|
void DateTime() | Default constructor. |
void DateTime(uint uiMilliseconds, int iSeconds, int iMinutes, int iHour, int iDayOfMonth, int iMonth, int iYear) | Init constructor. |
void DateTime(time_t time) | Unix timestamp constructor. |
void DateTime(const DateTime& in ref) | Copy constructor. |
DateTime& opAssign(const DateTime& in ref) | Assignment operator. |
DateTime& opAssign(time_t time) | Assignment operator. |
time_t ToUnixTimestamp() const | Get time as a unix timestamp. |
void SetUnixTimestamp(time_t time) | Sets time as a unix timestamp. |
uint GetMilliseconds() const | Get milliseconds. |
int GetSeconds() const | Get seconds (0-59). |
int GetMinutes() const | Get minutes (0-59). |
int GetHour() const | Get hours (0-23). |
int GetDayOfMonth() const | Get day of month (0-30). |
int GetMonth() const | Get month (0-11). |
int GetYear() const | Get year. |
void SetMilliseconds(uint uiMilliseconds) | Set milliseconds. |
void SetSeconds(int iSeconds) | Set seconds (0-59). |
void SetMinutes(int iMinutes) | Set minutes (0-59). |
void SetHour(int iHours) | Set hours (0-23). |
void SetDayOfMonth(int iDay) | Set day of month (0-30). |
void SetMonth(int iMonth) | Set month (0-11). |
void SetYear(int iYear) | Set year. |
int Format(string& out szResult, const string& in szFormat) const | Formats this datetime as a string. Returns the length of the destination string, or 0 if the buffer was not large enough. |
void ToString(string& out szResult) const | Returns a string representation of this datetime. |
bool opEquals(const DateTime& in other) const | Returns whether these two DateTimes represent the same time. |
int opCmp(const DateTime& in other) const | Comparison operator. |
TimeDifference opSub(const DateTime& in other) const | Subtracts the given DateTime from this one, resulting in a TimeDifference object. |
DateTime& opAddAssign(const TimeDifference& in diffTime) | Adds the given TimeDifference to this one. |
DateTime opAdd(const TimeDifference& in diffTime) const | Adds this DateTime and the given TimeDifferene together, returning a copy containing the new time. |