Sample Header Ad - 728x90

Convert seconds into HH:MM:SS

3 votes
2 answers
908 views
How is it possible to convert a float number of seconds to HH:MM:SS in Informix? I have a column that has a run duration of 1449.448520410. I want to convert this to a human-readable format. I have identified that running the below gives close to what I want, but excludes the hours:
select b.run_duration, 
       floor(run_duration / 60) || ':' || lpad(mod(run_duration, 60), 2, '0') as run_duration_time 
from ph_task a, ph_run b 
where a.tk_id = b.run_task_id 
order by run_duration DESC
Output:
-none
24:09
What I would like to see is:
-none
00:24:09
How can I customize my SQL to provide that?
Asked by Christopher Karsten (319 rep)
Dec 28, 2020, 09:12 AM
Last activity: Jan 11, 2025, 07:43 AM