#include <datetime.h>
Class that represents the Universal date-time (UTC+0000). This class should be used whenever you store date and time data and should be converted to the LocalDateTime for a local output as late as possible. The internal representation is an unsigned 64-Bit integer and contains the standard Unix date-time starting with 01/01/1970-00:00 UTC+0000. The resolution of this date-time class is 1-second.
Public Member Functions | |
| void | Reset () |
| Float64 | GetJulianDay (JULIANDATE variant) const |
| LocalDateTime | ConvertToLocalDateTime () const |
| RemoteDateTime | ConvertToLocalDateTime (const TimeValue &utcOffset, DST dst) const |
| UInt64 | GetUnixTimestamp () const |
| MAXON_OPERATOR_EQUALITY_HASHCODE (UniversalDateTime, _timestamp) | |
| Bool | operator< (const UniversalDateTime &x) const |
| MAXON_OPERATOR_INEQUALITY (UniversalDateTime) | |
| UniversalDateTime & | operator+= (const TimeValue &t) |
| UniversalDateTime & | operator-= (const TimeValue &t) |
| UniversalDateTime | operator+ (const TimeValue &t) const |
| UniversalDateTime | operator- (const TimeValue &t) const |
| TimeValue | operator- (const UniversalDateTime &x) const |
| Bool | IsValid () const |
| Bool | IsPopulated () const |
| Bool | IsEmpty () const |
| String | FormatTime (const Char *formatString) const |
| String | ToString (const FormatStatement *formatStatement=nullptr) const |
Static Public Member Functions | |
| static UniversalDateTime | GetNow () |
| static Result< UniversalDateTime > | FromValues (Int32 year, UChar month, UChar day, UChar hour, UChar minute, UChar second) |
| static UniversalDateTime | FromJulianDay (JULIANDATE variant, Float64 j) |
| static Float64 | ToJulianDay (JULIANDATE variant, Int32 year, UChar month, UChar day, UChar hour, UChar minute, UChar second) |
| static UniversalDateTime | FromUnixTimestamp (UInt64 timestamp) |
| static Result< void > | DescribeIO (const DataSerializeInterface &stream) |
| static MAXON_ATTRIBUTE_FORCE_INLINE const UniversalDateTime & | DefaultValue () |
Static Public Attributes | |
| static UniversalDateTime | g_defaultValue |
Private Attributes | |
| UInt64 | _timestamp |
| void Reset | ( | ) |
Reset all values to zero.
| Float64 GetJulianDay | ( | JULIANDATE | variant | ) | const |
Return the Julian day unit of the universal date-time object.
| [in] | variant | Julian Date Variant. |
| LocalDateTime ConvertToLocalDateTime | ( | ) | const |
Converts the universal date-time to a local date-time object in the current timezone.
| RemoteDateTime ConvertToLocalDateTime | ( | const TimeValue & | utcOffset, |
| DST | dst | ||
| ) | const |
Converts the universal date-time to a remote date-time.
| [in] | utcOffset | Timezone offset which will be added to the UTC value. |
| [in] | dst | If set, Daylight Saving Time will be added. |
| UInt64 GetUnixTimestamp | ( | ) | const |
Return the Unix time stamp.
| MAXON_OPERATOR_EQUALITY_HASHCODE | ( | UniversalDateTime | , |
| _timestamp | |||
| ) |
| Bool operator< | ( | const UniversalDateTime & | x | ) | const |
Compare for less.
| MAXON_OPERATOR_INEQUALITY | ( | UniversalDateTime | ) |
| UniversalDateTime& operator+= | ( | const TimeValue & | t | ) |
| UniversalDateTime& operator-= | ( | const TimeValue & | t | ) |
| UniversalDateTime operator+ | ( | const TimeValue & | t | ) | const |
| UniversalDateTime operator- | ( | const TimeValue & | t | ) | const |
| TimeValue operator- | ( | const UniversalDateTime & | x | ) | const |
| Bool IsValid | ( | ) | const |
Check if the UniversalDateTime has a timestamp greater than 0. Even 0 is a valid timestamp this function can be used to determine if the time object has a proper value.
| Bool IsPopulated | ( | ) | const |
| Bool IsEmpty | ( | ) | const |
Formats the time into a specific format defined be the format string.
| [in] | formatString | Optional. OS depending C lib format string (see strftime). "%Y-%m-%d %H:%M:%S" is used if formatString is nullptr. |
| String ToString | ( | const FormatStatement * | formatStatement = nullptr | ) | const |
Returns a readable string of the content.
| [in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Floating point values. |
|
static |
Return the current date-time object of the current time zone.
|
static |
Creates a universal date-time object by the passed date values.
| [in] | year | Year value [1970-3000] |
| [in] | month | Month value value [1-12] |
| [in] | day | Day value [1-31] |
| [in] | hour | Hour value [0-23] |
| [in] | minute | Minute value [0-59] |
| [in] | second | Second value [0-59] |
|
static |
Creates a date-time object by the passed Julian day.
| [in] | variant | Julian Date Variant. |
| [in] | j | The Julian day value. |
|
static |
Creates a Julian date value from single date components. Prefer using this function when you need to convert date-components to julian date, because UniversalDateTime cannot cover years older than 1970 so UniversalDateTime::GetJulianDay would fail.
| [in] | variant | Julian Date Variant. |
| [in] | year | Year value [1970-3000] |
| [in] | month | Month value value [1-12] |
| [in] | day | Day value [1-31] |
| [in] | hour | Hour value [0-23] |
| [in] | minute | Minute value [0-59] |
| [in] | second | Second value [0-59] |
|
static |
Create a universal date-time object by passing a Unix time stamp.
| [in] | timestamp | The Unix time stamp where value 0 represents the 01/01/1970-00:00 UTC. |
|
static |
Describe all elements of this class for I/O operations.
| [in] | stream | The stream that is used to register the class members. |
|
static |
Returns a default value of the UniversalDateTime (see defaultvalue.h for more details).
|
static |
|
private |