Container for date/time. More...
#include <mi32/datetime.h>
Public Types | |
| enum | FORMAT { FORMAT_ISO8601_Basic = 0, FORMAT_ISO8601_Extended = 1, FORMAT_XML_dateTime = 2, FORMAT_XML_date = 3, FORMAT_XML_time = 4, FORMAT_RFC822 = 5, FORMAT_Simple = 6, FORMAT_YYYYMMDD_HHMMSS = 7, FORMAT_Job = FORMAT_YYYYMMDD_HHMMSS } |
| enum | TIME { TIME_Uninitialized = 0, TIME_CurrentLocal = 1, TIME_CurrentUTC = 2 } |
Public Member Functions | |
| DATETIME (time_t value) | |
| DATETIME (const struct tm &rhs, bool bIsLocal) | |
| DATETIME (const RVCDATETIME &rhs) | |
| DATETIME (int year, int month, int day, int hour, int min, int sec, bool bIsLocal) | |
| DATETIME (int year, int month, int day) | |
| DATETIME (TIME value) | |
| DATETIME (const DATETIME &rhs) | |
| DATETIME () | |
| ~DATETIME () | |
| void | Clear () |
| void | ConvertToLocal () |
| void | ConvertToUTC () |
| void | Get (RVCDATETIME &dt) const |
| void | Get (struct tm &tm, bool bLocal=false) const |
| INT32 | GetDateJulian () const |
| double | GetDateTimeJulian () const |
| INT32 | GetDateYYYYMMDD () const |
| UINT32 | GetDayOfMonth () const |
| UINT32 | GetDayOfWeek () const |
| UINT32 | GetDayOfYear () const |
| MISTRING | GetFormatted (FORMAT format, bool IncludeLocal) const |
| UINT32 | GetHour () const |
| UINT32 | GetMin () const |
| UINT32 | GetMonth () const |
| UINT64 | GetNanoTime () const |
| UINT32 | GetSec () const |
| UINT32 | GetTimeOfDay (bool bLocal) const |
| time_t | GetTimeT () const |
| INT32 | GetYear () const |
| bool | IsLocalTime () const |
| bool | IsSet () const |
| bool | IsUTCTime () const |
| bool | IsValid () const |
| bool | operator!= (const DATETIME &rhs) const |
| bool | operator< (const DATETIME &rhs) const |
| bool | operator<= (const DATETIME &rhs) const |
| DATETIME & | operator= (DATETIME::TIME rhs) |
| DATETIME & | operator= (const time_t rhs) |
| DATETIME & | operator= (const RVCDATETIME &rhs) |
| DATETIME & | operator= (const DATETIME &rhs) |
| bool | operator== (const DATETIME &rhs) const |
| bool | operator> (const DATETIME &rhs) const |
| bool | operator>= (const DATETIME &rhs) const |
| const MIUNICODE * | Set (const MIUNICODE *str, const char *format="%c") |
| void | Set (const RVCDATETIME &rhs) |
| void | Set (const struct tm &rhs, bool bIsLocal) |
| void | Set (const time_t rhs) |
| void | SetBuild () |
| void | SetCurrent (bool bLocalTime=true) |
| void | SetDate (INT32 year, UINT32 month, UINT32 day) |
| void | SetDateJulian (INT32 juliandate) |
| void | SetDateTimeJulian (double juliandate) |
| void | SetDateYYYYMMDD (int yyyymmdd) |
| void | SetFormatted (const MISTRING &dtstr, FORMAT format) |
| void | SetNanoTime (UINT64 rhs) |
| void | SetTimeOfDay (UINT32 SecondsSinceMidnight, bool bIsLocal) |
| void | SetTimeOfDay (UINT32 hour, UINT32 min, UINT32 sec, bool bIsLocal) |
| void | StrfTime (MISTRING &str, const char *format, bool bLocal=true) const |
Container for date/time.
The date/time represented can be either UTC (a.k.a. GMT) or the local time zone.
| enum DATETIME::FORMAT |
| FORMAT_ISO8601_Basic |
Format is YYYYMMDDTHHMMSS.S+ZZ where 'T' is the separator, and ZZ is the time zone offset. |
| FORMAT_ISO8601_Extended |
Format is YYYY-MM-DDTHH:MM:SS.S+ZZ:ZZ where 'T' is the separator, and ZZ is the time zone offset. |
| FORMAT_XML_dateTime |
Format is defined by http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#dateTime. |
| FORMAT_XML_date |
Format is defined by http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#date. |
| FORMAT_XML_time |
Format is defined by http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#time. |
| FORMAT_RFC822 |
Format is dd mm yy hh:mm:ss zzz (SMTP format). |
| FORMAT_Simple |
Format is YYYY-MM-DD HH:MM:SS with no time zone specified. |
| FORMAT_YYYYMMDD_HHMMSS |
Format is YYYYMMDD_HHMMSS for job files. |
| FORMAT_Job |
Format is YYYYMMDD_HHMMSS for job files. |
| enum DATETIME::TIME |
| DATETIME::DATETIME | ( | ) |
Default constructor.
| DATETIME::DATETIME | ( | const DATETIME & | rhs | ) |
Copy constructor.
| DATETIME::DATETIME | ( | TIME | value | ) |
Constructor for a specific time.
| DATETIME::DATETIME | ( | int | year, | |
| int | month, | |||
| int | day | |||
| ) |
Construct for a given date.
Note, this one doesn't have the IsLocal parameter since no time is set.
| year | Year, must include centurary | |
| month | Month (Jan == 1) | |
| day | Day of month (1 - 31) |
| DATETIME::DATETIME | ( | int | year, | |
| int | month, | |||
| int | day, | |||
| int | hour, | |||
| int | min, | |||
| int | sec, | |||
| bool | bIsLocal | |||
| ) |
Construct for a given date/time.
| year | Year, must include centurary | |
| month | Month (Jan == 1) | |
| day | Day of month (1 - 31) | |
| bIsLocal | True if time is local, false if UTC |
| DATETIME::DATETIME | ( | const RVCDATETIME & | rhs | ) |
Construct from an RVCDATETIME.
Note: RVCDATETIMEs are always "local" time
| DATETIME::DATETIME | ( | const struct tm & | rhs, | |
| bool | bIsLocal | |||
| ) |
construct from a struct tm
| bIsLocal | True if time is local, false if UTC |
| DATETIME::DATETIME | ( | time_t | value | ) | [explicit] |
construct from a time_t.
Note, by definition, a time_t is always supposed to be UTC,
| DATETIME::~DATETIME | ( | ) |
Destructor.
| void DATETIME::Clear | ( | ) |
Clear.
| void DATETIME::ConvertToLocal | ( | ) |
Change internal representation from UTC to local time zone.
Does nothing if internal representation is already local.
| void DATETIME::ConvertToUTC | ( | ) |
Change internal representation local time zone to UTC.
Does nothing if internal representation is already UTC.
| void DATETIME::Get | ( | RVCDATETIME & | dt | ) | const |
Get the date/time as an RVCDATETIME.
Sets the count field to 0. RVCDATETIMEs are always be local time for historical reasons
| void DATETIME::Get | ( | struct tm & | tm, | |
| bool | bLocal = false | |||
| ) | const |
Get the date/time as a (struct tm).
Note, the tm_wday and tm_yday fields are not guarenteed to be filled out.
| bLocal | true to get local time, false to get UTC |
| INT32 DATETIME::GetDateJulian | ( | ) | const |
Return the Julian date.
| double DATETIME::GetDateTimeJulian | ( | ) | const |
Return the Julian date.
Returns Julian date as a double with the time represented as a fraction of a day
| INT32 DATETIME::GetDateYYYYMMDD | ( | ) | const |
Get the date as an integer in YYYYMMDD format.
This is the form RVC database DBFIELDTYPE_Date uses.
| UINT32 DATETIME::GetDayOfMonth | ( | ) | const |
Get the day of the month (1 - 31).
| UINT32 DATETIME::GetDayOfWeek | ( | ) | const |
Get day of the week (1 = Sunday, 7 = Saturday).
| UINT32 DATETIME::GetDayOfYear | ( | ) | const |
Returns the day of the year (1 - 366).
Get the string representation of the date / time according to the standard 'format' specified.
The return value can be used in a MISTRING << operation. Return the string representation of the date / time.
| IncludeLocal | Append local time zone information if the 'format' supports it |
| UINT32 DATETIME::GetHour | ( | ) | const |
Get the Hour value of the time.
| UINT32 DATETIME::GetMin | ( | ) | const |
Get the Minutes value of the time.
| UINT32 DATETIME::GetMonth | ( | ) | const |
Get the month number (1 - 12).
| UINT64 DATETIME::GetNanoTime | ( | ) | const |
Return the date given a 100 nanosecond interval from 1-jan-1601 (Windows FILETIME structure) This is the form RVC database DBFIELDTYPE_DateTime uses.
| UINT32 DATETIME::GetSec | ( | ) | const |
Get the Seconds value of the time.
| UINT32 DATETIME::GetTimeOfDay | ( | bool | bLocal | ) | const |
Get time in seconds past midnight.
| bLocal | true to get local time, false for UTC |
| time_t DATETIME::GetTimeT | ( | ) | const |
Get the current value as a time_t.
time_t values are always UTC
| INT32 DATETIME::GetYear | ( | ) | const |
Get the year, including century.
| bool DATETIME::IsLocalTime | ( | ) | const |
Returns true if the time represented by the local time zone.
| bool DATETIME::IsSet | ( | ) | const |
Determine if value has been set.
| bool DATETIME::IsUTCTime | ( | ) | const |
Returns true if the time represented by the class is in UTC.
Note, this is just !IsLocalTime()
| bool DATETIME::IsValid | ( | ) | const |
Determine if contains valid date and time.
| bool DATETIME::operator!= | ( | const DATETIME & | rhs | ) | const |
| bool DATETIME::operator< | ( | const DATETIME & | rhs | ) | const |
| bool DATETIME::operator<= | ( | const DATETIME & | rhs | ) | const |
| DATETIME& DATETIME::operator= | ( | DATETIME::TIME | rhs | ) |
assignment from time_t (assumed to be UTC (a.k.a. GMT))
| DATETIME& DATETIME::operator= | ( | const time_t | rhs | ) |
assignment from time_t (assumed to be UTC (a.k.a. GMT))
| DATETIME& DATETIME::operator= | ( | const RVCDATETIME & | rhs | ) |
Assignment from an RVCDATETIME.
| bool DATETIME::operator== | ( | const DATETIME & | rhs | ) | const |
| bool DATETIME::operator> | ( | const DATETIME & | rhs | ) | const |
| bool DATETIME::operator>= | ( | const DATETIME & | rhs | ) | const |
Set the time from a string.
See the man page for strptime() on most Unix systems for details
| format | See StrfTime |
| void DATETIME::Set | ( | const RVCDATETIME & | rhs | ) |
Set value from an RVCDATETIME.
Note, RVCDATETIMEs are stored as local, not UTC
| void DATETIME::Set | ( | const struct tm & | rhs, | |
| bool | bIsLocal | |||
| ) |
Set from (struct tm).
| bIsLocal | True if time is local, false if UTC |
| void DATETIME::Set | ( | const time_t | rhs | ) |
Set from time_t.
time_t values should always be UTC
| void DATETIME::SetBuild | ( | ) |
Set to 'build' date. Time will be 12:00 (noon) UTC.
| void DATETIME::SetCurrent | ( | bool | bLocalTime = true |
) |
Set to the current date/time.
| bLocalTime | True to set to local time, false for UTC |
Set the date (Leaves the time alone).
| year | must include century | |
| month | Jan == 1 | |
| day | 1 - 31 |
| void DATETIME::SetDateJulian | ( | INT32 | juliandate | ) |
Set the date given a julian date.
Leaves time fields alone.
| void DATETIME::SetDateTimeJulian | ( | double | juliandate | ) |
Set the date given a julian date.
time is set from the fractional part of the double
| void DATETIME::SetDateYYYYMMDD | ( | int | yyyymmdd | ) |
Set date given date in YYYYMMDD format Leaves time fields alone.
Set 'this' from the string representation of the date / time according to the standard 'format' specified.
The time value obtained from the formatted string will be converted to UTC time if the string includes the time zone offset.
| void DATETIME::SetNanoTime | ( | UINT64 | rhs | ) |
| void DATETIME::SetTimeOfDay | ( | UINT32 | SecondsSinceMidnight, | |
| bool | bIsLocal | |||
| ) |
Set the time in seconds since midnight.
Leaves date fields alone.
| bIsLocal | True if time is local, false if UTC |
Set the time in hours, minutes and seconds.
Leaves date fields alone.
| bIsLocal | True if time is local, false if UTC |
| void DATETIME::StrfTime | ( | MISTRING & | str, | |
| const char * | format, | |||
| bool | bLocal = true | |||
| ) | const |
Print a time/date to a MISTRING using strftime() formatting.
Does not clear the MISTRING first. The time/date string is appended to the current contents.
The format string must only use punctuation, whitespace and the following things...
| format | See strftime() documentation for details | |
| bLocal | True to show local time, false for UTC |
1.6.1