Page 1 of 1

Time math

Posted: Sat Jul 20, 2019 1:57 pm
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

Posted: Sat Jul 20, 2019 4:43 pm
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).

Posted: Mon Jul 22, 2019 7:12 pm
by ray.wurlod
Convert all to seconds only, do the math, then convert back to your favourite format.

Posted: Tue Jul 23, 2019 8:10 am
by chulett
So we basically said the same thing, I just used more words this time. :wink:

Posted: Wed Jul 24, 2019 7:31 am
by qt_ky
"You guys talk funny! Say more words!" -Patrick Star