Seconds to Time String Conversion

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
adamski
Charter Member
Charter Member
Posts: 54
Joined: Thu Mar 20, 2003 5:02 pm

Seconds to Time String Conversion

Post by adamski »

Hi All

Does anyone have a slick method of converting second to a time string on the format of h:mm:ss?

My source provides the time in seconds since midnight e.g:

21600 converts to 6:00:00
54060 converts to 15:01:00
84600 converts to 23:30:00

I know I can write a custom routine, however I was wondering if there is an easier way?

Thanks

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

Post by chulett »

OConv with the MTS conversion code. You've already got 'seconds since midnight', which equates to internal format, so all you need to do is the appropriate 'output conversion'.
-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 »

That's about it, though you might like to format the result. For example do you need no leading zeroes on the hour component?

Code: Select all

Oconv(InLink.Seconds, "MTS[Z,2,2]")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply