TIMEZONE
The SET TIMEZONE command changes the TIMEZONE run-time parameter for the current
session.
A SQL session is an occurrence of a user interacting with a database through the use of SQL statements. A session can be invoked using
vsql or a
JDBC application. In Vertica, the scope of a session is the same as that of a connection.
JDBC (Java Database Connectivity) is a call-level API that provides connectivity between Java programs and data sources (SQL databases and other non-relational data sources, such as spreadsheets or flat files). JDBC is included in the Java 2 standard and enterprise editions.
vsql is the Vertica implementation of psql, a character-based, interactive, front-end that is part of PostgreSQL and used by other database management systems. It allows you to type in SQL statements and see the results. It also provides a number of meta-commands and various shell-like features to facilitate writing scripts and automating a wide variety of tasks.
Syntax
SET TIMEZONE TO { value | 'value' }
Semantics
where value is one of the following:
- one of the time zone names specified in the tz database, as described in the Sources for Time Zone and Daylight Saving Time Data page. (The Time Zone Names for Setting TIMEZONE listed in the next section are for convenience only and may be out of date.)
- a signed integer representing an offset from
UTC in hoursUTC is an abbreviation of Coordinated Universal Time (in English), the high-precision atomic time standard that replaced Greenwich Mean Time on 1 January 1972 as the basis for the main reference time scale or civil time in various regions. UTC is also referred to by the military and civil aviation as Zulu time (Z).
- an interval value
- the built-in constants LOCAL and DEFAULT, which set the time zone to the one specified in the TZ environment variable or, if TZ is undefined, from the operating system time zone. See Set the Default Time Zone in the Installation Guide)
Notes
Examples
SET TIMEZONE TO DEFAULT;
SET TIMEZONE TO 'PST8PDT'; -- Berkeley, California
SET TIMEZONE TO 'Europe/Rome'; -- Italy
SET TIMEZONE TO '-7'; -- UDT offset equivalent to PDT
SET TIMEZONE TO INTERVAL '-08:00 HOURS';