SET TIME ZONE#

Примечание

Ниже приведена оригинальная документация Trino. Скоро мы ее переведем на русский язык и дополним полезными примерами.

Синтаксис#

SET TIME ZONE LOCAL
SET TIME ZONE expression
Copy to clipboard

Описание#

Sets the default time zone for the current session.

If the LOCAL option is specified, the time zone for the current session is set to the initial time zone of the session.

If the expression option is specified:

  • if the type of the expression is a string, the time zone for the current session is set to the corresponding region-based time zone ID or the corresponding zone offset.

  • if the type of the expression is an interval, the time zone for the current session is set to the corresponding zone offset relative to UTC. It must be in the range of [-14,14] hours.

Примеры#

Use the default time zone for the current session:

SET TIME ZONE LOCAL;
Copy to clipboard

Use a zone offset for specifying the time zone:

SET TIME ZONE '-08:00';
Copy to clipboard

Use an interval literal for specifying the time zone:

SET TIME ZONE INTERVAL '10' HOUR;
SET TIME ZONE INTERVAL -'08:00' HOUR TO MINUTE;
Copy to clipboard

Use a region-based time zone identifier for specifying the time zone:

SET TIME ZONE 'America/Los_Angeles';
Copy to clipboard

The time zone identifier to be used can be passed as the output of a function call:

SET TIME ZONE concat_ws('/', 'America', 'Los_Angeles');
Copy to clipboard

Limitations#

Setting the default time zone for the session has no effect if the sql.forced-session-time-zone configuration property is already set.

См. также#