- 13 Dec 2023
- 1 Minute to read
- DarkLight
ConvertToDateTime
- Updated on 13 Dec 2023
- 1 Minute to read
- DarkLight
General
The ConvertToDateTime function can be used to convert a value to a Date-Time.
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(<value>)
Examples
The following Expression returns the value of the variable vTest of Datasource MyDatasource as Date-Time:
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.