Skip to main content
Converts a Unix timestamp to a DATETIME type value based on the current time zone settings. For detailed instructions on setting a time zone, see Configure a time zone. If you want to convert a Unix timestamp to a DATETIME type value independent of the current session’s time zone settings, you can use to_datetime_ntz.

Syntax

Parameters

Return Value

  • On success: returns a DATETIME value based on the current session’s time zone.
  • On failure: returns NULL. Common reasons include:
    • Invalid scale (not 0, 3, or 6)
    • Value out of DATETIME range (0001-01-01 to 9999-12-31)

Example