StringToDate: Difference between revisions
(Created page with "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/...") |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
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. | 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 == | |||
<syntaxhighlight>StringToDate("MM/dd/yy")</syntaxhighlight> | <syntaxhighlight>StringToDate("MM/dd/yy")</syntaxhighlight> | ||
Line 10: | Line 10: | ||
<syntaxhighlight>StringToDate("MM/dd/yyyy")</syntaxhighlight> | <syntaxhighlight>StringToDate("MM/dd/yyyy")</syntaxhighlight> | ||
Where: | 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 == | |||
<syntaxhighlight>StringToDate("01/01/2008");</syntaxhighlight> | |||
Will return a value of 39448.00000000, corresponding to the specified date of January 1st, 2008. | |||
<syntaxhighlight>StringToDate("04/04/99");</syntaxhighlight> | |||
Will return a value of 36254.00000000, corresponding to the specified date of April 4th, 1999. | |||
[[Category:Date and Time Routines]] | [[Category:Date and Time Routines]] |
Latest revision as of 13:31, 4 February 2012
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.