Converts parameters into a date time value, depending on their types.
Conversion
toDateTime(<parameters>)
Parameter | Type |
---|---|
date time in ISO-8601 format | string |
time zone id | string |
date time without time zone | dateTimeOnly |
integer value of an epoch in milliseconds | integer |
Time zone id must be a string constant. It cannot be a field reference nor an expression. For more information on data types, refer to this page.
toDateTime(<string>)
toDateTime(<stringified time zone id>, <dateTimeOnly>)
toDateTime(<integer>)
Return a dateTime.
toDateTime ("2023-08-18T23:17:59.123Z")
Returns 2023-08-18T23:17:59.123Z
toDateTime(toDateTimeOnly("UTC", "2023-08-18T23:17:59.123"))
Returns 2023-08-18T23:17:59.123Z
toDateTime(1560762190189)
Returns 2023-06-17T09:03:10.189Z