Time math

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
bhush
Participant
Posts: 1
Joined: Fri May 26, 2017 6:47 am
Location: india

Time math

Post by bhush »

one scenario:ANY GENIUS I am struggling
I have 3 columns
col1:1.40(1 minute 40 seconds)datatype(decimal)
col2:1.40(same as above)
col3:1.40(same as above)

I want to add 3 times and get output as 05.00 (min:sec)

in netezza or datastage transformer.
thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Okay... not sure how we ended up with three of these posts but there's only one now. And I updated your subject, "datastage" doesn't work all that well seeing as how that's what everything is about here. :wink:

That being said, have you looked into the parallel functions? Thinking either the Date and Time functions or the Conversion functions like DecimalToTime could be leveraged. Or go old school and just do straight math... for example, convert 1.40 into 100 seconds (1x60+40) which sum to 300 seconds and then you could break that back down to your minutes and seconds for the target (trunc(300/60).remainder).
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Convert all to seconds only, do the math, then convert back to your favourite format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So we basically said the same thing, I just used more words this time. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

"You guys talk funny! Say more words!" -Patrick Star
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply