ToDate Function
Use ToDate to convert values from a different data type to a date.
ToDate supports the following data types:
- text
- whole number
- date
Description 1 of 4 (convert a text value):
Convert a text value to a date value.
The text value must be one of the forms:
- "yyyy/mm/dd"
- "mm/dd/yyyy"
where the year, month and day components may also be separated by "-" or space characters.
note
This function is non-evaluable if the text value does not match one of the above forms.
Returns:
Date
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Text | The text to be converted. |
Examples:
When using functions inside a field, remember the field brackets:
{ToDate(VariableName)}
Expression | Result |
|---|---|
ToDate( "2000-02-29" ) | Date( 2000, 2, 29 ) |
ToDate( "2/29/2000" ) | Date( 2000, 2 ,29 ) |
Description 2 of 4 (convert a whole number value):
Convert a whole number value to a date value.
The whole number represents the number of whole days since 1899/12/30. That is, for any date D:
D
= DaysBetween( Date( 1899, 12, 30 ), ToDate( D
) )Returns:
Date
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Whole Number | The whole number to be converted. |
Examples:
When using functions inside a field, remember the field brackets:
{ToDate(VariableName)}
Expression | Result |
|---|---|
ToDate( 2 ) | Date( 1900, 1, 1 ) |
ToDate( 61 ) | Date( 1900, 3, 1 ) |
ToDate( 36585 ) | Date( 2000, 2, 29 ) |
Description 3 of 4 (convert a list of text values):
Convert a list of text values to a list of date values.
The text values must be one of the forms:
- "yyyy/mm/dd"
- "mm/dd/yyyy"
where the year, month and day components may also be separated by "-" or space characters.
note
This function is non-evaluable if the any of the text values do not match one of the above forms.
Returns:
Date*
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Text* | The list of text values to be converted. |
Examples:
When using functions inside a field, remember the field brackets:
{ToDate(VariableName)}
Expression | Result |
|---|---|
ToDate( List( "2000-02-29", "2010 11 11", "6/10/1948") ) | List( Date( 2000, 2, 29 ), Date( 2010, 11, 11 ), Date( 1948, 6, 10 ) ) |
ToDate( "2/29/2000", "2004 8 1") | List( Date( 2000, 2, 29 ), Date( 2004, 8, 1) ) |
Description 4 of 4 (convert a list of whole number values):
Convert a list of whole number values to a list of date values.
The whole number represents the number of whole days since 1899/12/30. That is, for any date D:
D
= DaysBetween( Date( 1899, 12, 30 ), ToDate( D
) )Returns:
Date*
Parameter:
Parameter | Data Type | Description |
|---|---|---|
1 | Whole Number* | The list of whole number values to be converted. |
Examples:
When using functions inside a field, remember the field brackets:
{ToDate(VariableName)}
Expression | Result |
|---|---|
ToDate( List(2, 3, 4) ) | List(Date( 1900, 1, 1 ), Date( 1900, 1, 2 ), Date( 1900, 1, 3 ) ) |
ToDate( List(61, 40858) ) | List(Date( 1900, 3, 1 ), Date( 2011, 11, 11 ) ) |
ToDate( List(36585, 17694) ) | List(Date( 2000,2,29 ), Date( 1948, 06, 10 ) ) |