SET TIME ZONE
Changes the TIME ZONE run-time parameter for the current session. Use
SHOW TIMEZONE
to show the session's current time zone.
If you set the timezone using POSIX format, the timezone abbreviation you use overrides the default timezone abbreviation. If the date style is set to POSTGRES, the timezone abbreviation you use is also used when converting a timestamp to a string.
Syntax
SET TIME ZONE [TO] { value | 'value' }
Note
Vertica treats literalsTIME ZONE
and TIMEZONE
as synonyms.
Parameters
value
- One of the following:
-
A time zone literal supported by Vertica. To view the default list of valid literals, see the files in the following directory:
/opt/vertica/share/timezonesets
-
A signed integer representing an offset from UTC in hours
-
A time zone literal with a signed integer offset. For example:
=> SET TIME ZONE TO 'America/New York -3'; -- equivalent to Pacific time
Note
Only valid timezone+offset combinations are meaningful as arguments to SET TIME ZONE. However, Vertica does not return an error for meaningless combinations—for example,America/NewYork + 150
. -
Constants
LOCAL
andDEFAULT
, which respectively set the time zone to the one specified in environment variableTZ
, or ifTZ
is undefined, to the operating system time zone.
Only valid (timezone+offset) combination are acceptable as parameter for this function.
-
Privileges
None
Examples
=> SET TIME ZONE TO DEFAULT;
=> SET TIME ZONE TO 'PST8PDT'; -- Berkeley, California
=> SET TIME ZONE TO 'Europe/Rome'; -- Italy
=> SET TIME ZONE TO '-7'; -- UDT offset equivalent to PDT
=> SET TIME ZONE TO INTERVAL '-08:00 HOURS';