Publishing activation date for different Time Zones in XML

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
alla
Participant
Posts: 17
Joined: Thu May 17, 2007 9:28 am
Location: New York

Publishing activation date for different Time Zones in XML

Post by alla »

I have XML job which extracts data from Sybase server and publishes it to the XML file. Now we display date/time field in EST time, but for some
companies we need to display date/time filed converting to a different time zone. I reviewed DataStage Date functions, but didn't find any which I can use. Please advise.

Thank you,

Alla
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Post by uegodawa »

I had the same issue and I wrote a routine and called this rouitine within a Basic Transformer.
Thanks,
Upul
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Post by uegodawa »

I had the same issue and I wrote a routine and called this rouitine within a Basic Transformer.
Thanks,
Upul
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In other words, nothing specific for timezones exist, you'll need to spec out and write your own.
-craig

"You can never have too many knives" -- Logan Nine Fingers
alla
Participant
Posts: 17
Joined: Thu May 17, 2007 9:28 am
Location: New York

Post by alla »

uegodawa wrote:I had the same issue and I wrote a routine and called this rouitine within a Basic Transformer.
What language and platform did you use for Routine?
How do you handle DST?


Thank you for your help,

Alla
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

BASIC Transformer would mean a Server routine written in BASIC. And I'd wager they didn't. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Post by uegodawa »

My Requirement was convert EST to GMT. This is a sample code used for particular task.

Input
Date : YYYYMMDD
Time : HH:MI:SS (24 hour clock)
Zone : EST

output : Corresponding GMT value
YYYY-MM-DD HH:MI:SS


* This routine will convert given date/time according to the given time zone
* Output will be corresponding GMT time

vTime = iconv(pTime,"MTS")

*Default Value for output

yyyy=pDate[1,4]
mm=pDate[5,2]
dd=pDate[7,2]

vDate=dd:'/':mm:'/':yyyy

*Output Date format
oDate = yyyy:'-':mm:'-':dd

Ans=oDate:' ' :pTime


* Assumption EST = GMT - 5
if pZone = 'EST' then
if vTime < 19 * 60 * 60 Then
vTime = oconv(vTime + (5 * 60 * 60),"MTS")
vDate = oConv(oDate,"D-YMD[4,2,2]")

end
else
vTime = oconv(vTime + (5 * 60 * 60),"MTS")
vDate = Iconv(pDate, "D/E") + 1
vDate = oConv(vDate,"D-YMD[4,2,2]")
end

Ans = vDate:' ':vTime

end
Thanks,
Upul
alla
Participant
Posts: 17
Joined: Thu May 17, 2007 9:28 am
Location: New York

Post by alla »

uegodawa wrote:My Requirement was convert EST to GMT. This is a sample code used for particular task.



* Assumption EST = GMT - 5
if pZone = 'EST' then
if vTime < 19 * 60 * 60 Then
vTime = oconv(vTime + (5 * 60 * 60),"MTS")
vDate = oConv(oDate,"D-YMD[4,2,2]")

end
else
vTime = oconv(vTime + (5 * 60 * 60),"MTS")
vDate = Iconv(pDate, "D/E") + 1
vDate = oConv(vDate,"D-YMD[4,2,2]")
end

Ans = vDate:' ':vTime

end
Hi Upul,

Thank you for your help.
Our task is to be able to convert to any Time Zone.
We cannot hard code assumptions for the time difference, because of Daylight Saving Time.


Alla
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, you'll either need to craft your own or I'd wager there are third-party libraries out there you could leverage in a BuildOp or something similar for an exchange of currency.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply