Examples | TIMESTAMP-to-TIME Conversion | Teradata Vantage - 17.10 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

In this example, the current session time zone displacement, INTERVAL '01:00' HOUR TO MINUTE, is used to determine the UTC value, '2008-06-01 07:30:00', of the TIMESTAMP literal.

The result of the CAST is the time formed from the time portion of the source expression value '2008-06-01 07:30:00' at UTC and the current time zone displacement, INTERVAL '01:00' HOUR TO MINUTE.

The result value of the CAST '07:30:00' at UTC is adjusted to its time zone displacement, INTERVAL '01:00' HOUR TO MINUTE, and the result of the SELECT statements is: TIME '08:30:00+01:00'.

The result of the SELECT statements is equal to TIME '07:30:00+00:00' since values are compared based on their UTC values.

SET TIME ZONE INTERVAL '01:00' HOUR TO MINUTE;
   
SELECT CAST(TIMESTAMP '2008-06-01 08:30:00' AS TIME(0) 
   WITH TIME ZONE);
SELECT CAST(TIMESTAMP '2008-06-01 08:30:00' AS TIME(0) 
   WITH TIME ZONE AT LOCAL);