--- title: "ConvertToDateTime" slug: "converttodatetime" updated: 2024-05-04T19:23:26Z published: 2024-05-04T19:23:26Z canonical: "help.mail-and-deploy.com/converttodatetime" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.mail-and-deploy.com/llms.txt > Use this file to discover all available pages before exploring further. # ConvertToDateTime ### General The *ConvertToDateTime* function can be used to convert a value to a [Date-Time](/release34/docs/date-time). NOTE If the value cannot be converted to a date-time (e.g. when trying to convert the [String](/release34/docs/string) "*This is a text*" to a date-time), the execution of the report document preview or task will fail. The function can convert text values (i.e. a text representation) and numeric values (i.e. an OLE Date-Time Representation) to date-times. Text values can be converted to date-times when they contain a date-time in text representation that can be parsed (which depends on the currenctly active culture or regional settings of the server). ### Syntax The syntax of the *ConvertToDateTime* function is: ConvertToDateTime Function Syntax ConvertToDateTime() ### Examples The following [Expression](/release34/docs/introduction-to-mail-and-deploy-expressions) returns the value of the variable *vTest* of [Datasource](/release34/docs/introduction-to-datasources) MyDatasource as [Date-Time](/release34/docs/date-time): ConvertToDateTime Function Example ConvertToDateTime([Datasource].[MyDatasources].[Variable].[vTest]) If the variable contains a [String](/release34/docs/string) with value "*2021-12-30T04:00*" then the returned date-time will be December 30th 2021 4AM.