Page 1 of 1

UTC to AEST

Posted: Sun Jan 29, 2017 10:47 pm
by SURA
Hello All

Source : File
Target : Table
UTC Time: Timestamp (yyyy-mm-dd hh:mm:ss)

I have a reference table where i can get the offset numbers such as 11 or 10 based on the range lookup with the source data.

Is there any inbuilt Datastage function i could use to add the offset numbers with the input time stamp to get the AEST ?

Any suggestion ?

Posted: Sun Jan 29, 2017 11:27 pm
by ray.wurlod
There is no such built-in function. For a small number of rows, where performance isn't a big issue, you could make a call to any of the web services out there that can effect this conversion.

Posted: Mon Jan 30, 2017 7:36 am
by chulett
AEST as in Australian Eastern Standard Time? And you are already looking up a number of hours you need to add to the timestamp?

DateOffsetByComponents()

Posted: Mon Jan 30, 2017 3:39 pm
by SURA
Thanks Ray

Posted: Mon Jan 30, 2017 3:40 pm
by SURA
Thanks chulett.

Yes it is.

I will check this.

Posted: Mon Jan 30, 2017 3:58 pm
by chulett
Yes, the fact that I copied the wrong function name as you're obviously not dealing with a date. :wink:

Oddly enough, the correct one would be:

TimestampOffsetByComponents()

Posted: Mon Jan 30, 2017 4:21 pm
by SURA
It worked perfectly.

Thanks to all for your help.

Posted: Wed Feb 01, 2017 6:16 pm
by ray.wurlod
Don't forget to change the constant when daylight saving time ends and begins. (A constant is a poor solution, imho.)

Posted: Wed Feb 01, 2017 8:21 pm
by SURA
Thanks Ray for cautioning.

In this office somehow a manual process has been implemented as someone who physically update the reference table to get the offset. This table will always (I wish always) have the data for 2 years ahead. So it should be alright as far the data is being updated in time. To handle the risk, i am storing the original value too. In case the reference source fails to update the data, still a manual update can fix the issue.

Again thanks Ray for your comment.