Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

ToDateTime

This section contains reference documentation for the ToDateTime function.

Converts from milliseconds to a formatted date-time string, based on the provided Joda-Time pattern.

Signature

ToDate(millis, pattern)

ToDate(millis, pattern, timezoneId)

Usage Examples

SELECT ToDateTime(1639137263000, 'yyyy-MM-dd') AS dateTimeString
FROM ignoreMe
dateTimeString

2021-12-10

SELECT ToDateTime(
    1639137263000, 
    'yyyy-MM-dd hh:mm:ss a'
    ) AS dateTimeString
FROM ignoreMe
dateTimeString

2021-12-10 11:54:23 AM

SELECT ToDateTime(
    1639137263000, 
    'yyyy-MM-dd HH:mm:ss Z',
    'CET'
    ) AS dateTimeString
FROM ignoreMe
dateTimeString

2021-12-10 12:54:23 +0100

Last updated

Was this helpful?