Deriving Date based on given Time zone

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Deriving Date based on given Time zone

Post by koolnitz »

Hello All

I have a requirement to find out current date for a country by having it's Time zone info. Am trying to explain my requirement through the following example..

DS server has been installed in Hong Kong and I need to find out current date in India. I'm thinking to introduce two parameters (e.g. prmServerTimeZone=+8 and prmCountryTimeZone=+5.5 , indicates that HK is GMT+8 and India is GMT+5.5). Parameters are appreciated for the case we deploy the project elsewhere.


Can someone please help me to find out the current date for India using DataStage? I'm asked not to bother about Daylight saving.

Suggestion about any better approach would be appreciated.

Thanks in advance!
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Assuming you have the parameters you've shown? Adjust the time by the difference in them: -2.5 hours in your example.
-craig

"You can never have too many knives" -- Logan Nine Fingers
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Hi Craig,

I'm unable to find a way to subtract hours from Date :?:
Suppose, if the current timestamp of server is 2007-11-14-01.09.50.384917, then the desired output should be a Date field with value 2007-11-13, for the given example.

Thanks!
Last edited by koolnitz on Wed Nov 14, 2007 7:23 am, edited 1 time in total.
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry, I'm not familiar enough with the date/time functions in PX to give anything other than high-level advice. :(

So, you don't need to figure out the time difference, just if the timezone change affected the date or not? Make sure your requirement is clear, then others can give you specific help with the functions.
-craig

"You can never have too many knives" -- Logan Nine Fingers
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Sorry if I was unable to express my requirement clearly.

Yes, I don't need to figure out the time difference. I just want capture the current date of a country with the help of it's given timezone (GMT+/-n).
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Following derivation logic works when used in Transformer:

TimestampToDate(TimestampFromSecondsSince(-(GetEnvironment('prmServerTimeZone')-GetEnvironment('prmCountryTimeZone'))*3600, CurrentTimestamp()))

Forgot to mention that the given parameters have been defined as Environment variables, hence used GetEnvironment() function.

:)
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
Post Reply