TIMEZONE

Applies to: check marked yes Databricks SQL

The TIMEZONE configuration parameter controls the local timezone used for timestamp operations within a session.

You can set this parameter at the session level using the SET statement and at the global level using SQL configuration parameters or the SQL Warehouse API.

An alternative way to set the session timezone is using the SET TIME ZONE statement.

Setting

The parameter may be set to one of these values:

  • Region base zone ID

    Region IDs must have the form ‘area/city’, such as America/Los_Angeles.

    For a list of valid timezones, see List of tz database time zones.

  • Zone offset

    Zone offsets must be in the format ‘(+|-)HH’, (+|-)HH:mm or (+|-)HH:mm:ss, e.g -08, +01:00 or -13:33:33. Also, ‘UTC’ is supported as an alias for +00:00.

Other short names are not recommended to use because they can be ambiguous.

System default

The system default is UTC.

Examples

-- Set time zone to the region-based zone ID.
> SET timezone = America/Los_Angeles;
> SELECT current_timezone();
  America/Los_Angeles

-- Set time zone to the Zone offset.
> SET timezone = +08:00;
> SELECT current_timezone();
  +08:00