StringToDate

From MultiCharts
Jump to navigation Jump to search

Returns the integer portion of a double-precision decimal DateTime value, corresponding to the specified date. The date is specified by a string expression "MM/dd/yy"* or "MM/dd/yyyy"*, where MM* is the month, dd* is the day, and yy or yyyy is a two-digit or four-digit year.

The integer portion of the DateTime value indicates the number of days that have elapsed since January 1st, 1900, and the fractional portion of the DateTime value indicates the fraction of the day that has passed since midnight.

Usage

StringToDate("MM/dd/yy")

or:

StringToDate("MM/dd/yyyy")

Where:

MM - month*
dd - day of the month*
yy - a two-digit year
yyyy - a four-digit year

Notes

*: Described usage and examples are for the default US regional date format. If the default UK regional format is selected, the dates will be in dd/MM/yy and dd/MM/yyyy format instead. Date format is controlled by the Regional Options settings that can be accessed from the Control Panel of the Windows XP operating system.

Example

StringToDate("01/01/2008");

Will return a value of 39448.00000000, corresponding to the specified date of January 1st, 2008.

StringToDate("04/04/99");

Will return a value of 36254.00000000, corresponding to the specified date of April 4th, 1999.