Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert seconds to time format

Status
Not open for further replies.
Mar 19, 2003
57
US
Crystal Reports 9
Informix 7
No authorization to create views or stored procedures.

I'm using the following formula to convert number data type to time format. It works fine, except in this type of situation when 60 seconds doesn't convert over to a minute. For example, 00:12:60. In this case, it should be 00:13:00
Any pointers would help.

ASAALL is a variable.

(Hours1:= ToText(Truncate(asaall/3600),0);
Minutes1:= ToText(Truncate(Remainder(asaall,3600)/60),0);
Seconds1:= Totext(Remainder(Remainder(asaall,3600),60),0));

(if length(Hours1) < 2 then '0') + Hours1 +":"+
["0",""][length(Minutes1)] + Minutes1 +":"+
["0",""][length(Seconds1)] + Seconds1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top