Date/time format.


The article introduces the date/time format.


All date and time is presented in the OLE Automation date format.

The OLE Automation date is implemented as a floating-point number whose value is the number of days from midnight, 30 December 1899. For example, midnight, 31 December 1899 is represented by 1.0; 6 A.M., 1 January 1900 is represented by 2.25; midnight, 29 December 1899 is represented by -1.0; and 6 A.M., 29 December 1899 is represented by -1.25. The base OLE Automation Date is midnight, 30 December 1899.

The integer part of the value is the number of days past 30/12/1899 0:00:00. The fractional part is the time expressed in the number of days as well. So, 1 second is equal to 1 / 86400.

Please note that this format does not contain information about the time zone. The interpretation of this value as a local time completely depends on the agreement between the host application and the indicators. For example, Marketscope application always provides and the date and time in the NY time zone (EST/EDT).

To convert the OLE Automation date into the SYSTEMTIME format and back use Win32 functions:

int SystemTimeToVariantTime(SYSTEMTIME lpSystemTime, double* pvtime);


int VariantTimeToSystemTime(double vtime, LPSYSTEMTIME lpSystemTime);

These functions are declared in the oleauto.h and are defined in oleaut32.lib.