TD Function to convert UTC to PST while loading data into a column

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Enthusiast

TD Function to convert UTC to PST while loading data into a column

As per my business logic, I am getting timestamp in UTC format in a column. While loading to my target table, I want to load in PST. I cannot just add/subtract hours from it since I need to consider day light saving into account. Could someone help me with any function available in Teradata to convert the same.


Accepted Solutions
Junior Contributor

Re: TD Function to convert UTC to PST while loading data into a column

Try concatenating the time zone '+00:00' to the input and then:

 

select timestamp '2017-07-14 10:00:50+00:00' AT 'America Pacific'
1 ACCEPTED SOLUTION
5 REPLIES
Junior Contributor

Re: TD Function to convert UTC to PST while loading data into a column

How does the source data look like?

Is the target column a Timestamp with or without time zone?

What is your system/session time zone?

Enthusiast

Re: TD Function to convert UTC to PST while loading data into a column

Source is from hadoop. Target table is what I create. I can have any format. My current system time is in PST.
Junior Contributor

Re: TD Function to convert UTC to PST while loading data into a column

Try concatenating the time zone '+00:00' to the input and then:

 

select timestamp '2017-07-14 10:00:50+00:00' AT 'America Pacific'
Enthusiast

Re: TD Function to convert UTC to PST while loading data into a column

Thanks Dieter. It worked. Just curious to know is there any system table which has list of timestamp formats like 'America Pacific'.

Junior Contributor

Re: TD Function to convert UTC to PST while loading data into a column

Afaik there's no table, but there's a list of time zone strings in the manuals.