DateCurrentGMTTime sdk transform

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
levans
Participant
Posts: 3
Joined: Mon Aug 12, 2002 8:23 am
Location: USA

DateCurrentGMTTime sdk transform

Post by levans »

I am trying to convert seconds since Jan 1, 1970 GMT to a date/time. I have modified the DateCurrentGMTTime transform to look like this:
(I am trying to change a given date/time rather than the current system date)

OCONV(DIV(outProfile.DTLastMod, 86400) + 732, "D4-YMD[4,2,2]") : " " : OCONV(MOD(outProfile.DTLastMod, 86400), "MTS:") : ".000"

(This gives me the date/time in GMT and I subract 6 hours to get the needed Central Standard Time)

This is working like I want it to, except that daylight savings time causes any date/times during daylight savings time (Apr-Oct) to be one hour behind, while all other date/times are correct. I expect that in Apr when I run this transform all the date/times from (Nov-March) will be one hour ahead and all others will be correct.

I have thought about adding a stipulation to my logic to look at what month the date has, but I think that this could get complicated because each year the date in which daylight savings time begins and ends changes.

Does anyone have any suggestions as to how I should handle this? Is there another way that I could convert seconds since Jan 1, 1970 GMT to a date/time in CST?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You are fortunate that you live in a part of the world where the change to and from daylight saving time is on dates specified in legislation and, therefore, "locked in".

You can build this knowledge into your routine. For example "the first Sunday in April" or "the last Sunday in April" can be easily calculated using date-handling functions (for example, calculate the internal date of 01 APR, then loop forward until the day of week is "Sunday", or calculate the internal date of 01 MAY and loop backwards until the day of week is "Sunday"), and you can make your one-hour adjustment accordingly.

Depending on your exact operating system, the knowledge may also be available from the TZ environment variable or something similar.

(You still need to be alert for "political" changes - for example for the 2000 Sydney Olympic Games "they" started daylight saving time three weeks earlier than usual!)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply