Example

Teradata Vantageā„¢ Data Types and Literals

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

In this example, the tswz column in table1 contains the following timestamp data:

SELECT * FROM table1;

The result of the query is:

                               tswz
-----------------------------------
   2011-11-04 13:14:00.860000-07:00

You can use an AT clause with a time zone string in a SELECT query to get the same time in a different time zone. For example:

SELECT CAST(tswz AS TIMESTAMP WITH TIME ZONE AT 'gmt') 
FROM table1; 

The result of the query is:

                               tswz
-----------------------------------
   2011-11-04 20:14:00.860000+00:00

Similarly, you can use an AT clause with a time zone displacement to get the same result.

SELECT CAST(tswz AS TIMESTAMP WITH TIME ZONE AT TIME ZONE '00:00')
FROM table1; 

The result of the query is:

                               tswz
-----------------------------------
   2011-11-04 20:14:00.860000+00:00

The following query produces the same result without an explicit CAST:

SELECT tswz AT 'gmt' FROM table1;

The result of the query is:

            tswz AT TIME ZONE 'gmt'
-----------------------------------
   2011-11-04 20:14:00.860000+00:00