--- title: "ConvertToDate" slug: "converttodate" updated: 2024-05-04T19:22:10Z published: 2024-05-04T19:22:10Z canonical: "help.mail-and-deploy.com/converttodate" --- > ## 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. # ConvertToDate ### General The *ConvertToDate* function can be used to convert a value to a [Date-Time](/release34/docs/date-time) where the time will be set to midnight (beginning of the day). NOTE 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 dates. Text values can be converted to date when they contain a date 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 *ConvertToDate* function is: ConvertToDate Funcfion Syntax ConvertToDate() ### 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): ConverToDate Function Example ConvertToDate([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 midnight (beginning of that day).