Page 1 of 1

Seconds to Time String Conversion

Posted: Sun Feb 18, 2007 5:32 pm
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

Posted: Sun Feb 18, 2007 6:04 pm
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'.

Posted: Sun Feb 18, 2007 6:55 pm
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]")