time stamp conversion

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

samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

DSGuru i divided the field into 2 parts using the stage variables A and B , A contain Jul 7 1998 12:19:52:236 and B contain PM . i used your code on A i got the output as 1998-07-17 12:19:52 . i am not getting :000 even after usin .3 in format. How should i use B i,e PM/AM to get 24 hrs format?
hi sam here
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Use a Stage Variable:
sV >> If inTime = 'AM' then 1 else 0

In the Column Derivation:

Code: Select all

If sV = 0 then 
Field(incol," ",1):" ":TimeFromMidnightSeconds(
(HoursFromTime(Field(incol," ",2)) * 3600) + 
(MinutesFromTime(Field(incol," ",2)) * 60) + 
(SecondsFromTime(Field(incol," ",2))) + 
(12 * 3600)
) 
else incol
Test this...
IHTH
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Where are you changing the format? The StringToTimestamp() changes the string into a timestamp. The format of the timestamp will depend upon the default that is set in your target stage. I hope you are giving the .3 in the default timestamp of the target stage.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

i gave .3 in defaul format now iam getting .000 at the end of my date but i am expecting .236. Why it is not reading that.....???
hi sam here
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I dont think you will get that. It will only add zeros.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply