The TextToDateTime function is a built-in function that converts Text t to a datetime value.

If t can't be converted to a valid Date Time value, the function will return a Date Time default value. To check if the conversion is possible you can use the TextToDateTimeValidate function.

Input parameters

t: Text Type

Output parameters

Date Time Type

Examples

Usage

Result

TextToDateTime( "2002-01-01 01:01:01" )

#2002-01-01 01:01:01#

TextToDateTime( "2002/01/01 01:01:01" )

#2002-01-01 01:01:01#

TextToDateTime( "2002.01.01 01:01:01" )

#2002-01-01 01:01:01#

TextToDateTime( "20-01-01 01:01:01" )

#1900-01-01 00:00:00#

TextToDateTime( "date time" )

#1900-01-01 00:00:00#

TextToDateTime( "2002.1.1 1-1-1" )

#1900-01-01 00:00:00#

TextToDateTime( "2002-01-01" )

#2002-01-01 00:00:00#

TextToDateTime( "01-01-01" )

#1900-01-01 00:00:00#

Remarks

You should check the limits of the DateTime data type. You should also ensure that the date you type in the argument complies with the default date format (YYYY-MM-DD, YYYY/MM/DD, and YYYY.MM.DD) or the server’s environment configuration.

See Also

TextToDateTimeValidate Function | Available Conversion Functions to Date Time | Available Built-in Functions