Converting from DB2 time to DS time

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Converting from DB2 time to DS time

Post by patonp »

I'm receiving data in a db2 extract where the time is represented by an integer based on the number of milliseconds that have elapsed since midnight. I'd like to convert this to a standard time format (i.e. HH:MM:SS.TTT). I realize that I can write my own routine to do this, but I'm hoping that there might be some out-of-the-box functionality in DS that does the conversion for me.

Any suggestions?

BTW - although I've classified this as a Parallel job type, I'm open to options on either canvas...

Cheers,

Peter
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Use TimeFromMidnightSeconds() function to get the time. But this function requires seconds since midnight and not milliseconds, so you will have to divide you will have to divide the number by 60 to get seconds. So you decide, can you live with getting time upto seconds or not.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rafik2k
Participant
Posts: 182
Joined: Wed Nov 23, 2005 1:36 am
Location: Sydney

Post by rafik2k »

DSguru2B ,
Since Peter is already getting time in milliseconds,
I think he needs to multiply with it to get seconds, not divide.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Really, think again :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
patonp
Premium Member
Premium Member
Posts: 110
Joined: Thu Mar 11, 2004 7:59 am
Location: Toronto, ON

Post by patonp »

Thanks for the suggestion!
Post Reply