--- title: "ConvertToDateTime" slug: "converttodatetime" description: "Reference for the ConvertToDateTime function: how it converts a value to a date and time, the formats accepted, and an example." updated: 2025-10-07T09:58:30Z published: 2025-10-07T11:02:35Z 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. NOTE If the value cannot be converted to a date-time (e.g. when trying to convert the 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 returns the value of the variable vTest of Datasource MyDatasource as Date-Time: ConvertToDateTime Function Example ConvertToDateTime([Datasource].[MyDatasources].[Variable].[vTest]) If the variable contains a String with value "2021-12-30T04:00" then the returned date-time will be December 30th 2021 4AM.