I am retrieving a series of statistics from Amazon Redshift with a SQL query as follows:
`select a.query as idquery,a.starttime as inicio,a.endtime as
fin,datediff(ms,inicio,fin) as tiempototal,
datediff(ms,queue_start_time,queue_end_time) as tiempo_total_cola
from stl_query a, stl_wlm_query b where a.query=b.query and tiempototal >=
14400000 order by idquery`
The field tiempototal
returns a value in ms: 33084769 and I would like to get it in HH:MM:SS format
How can I convert in the same query tiempototal
and tiempo_total_cola
in HH:MM:SS format? That is, I need to output the duration in hours and minutes.
You can with a little arithmetic
Each value you divide by is the number of milliseconds in a day, hour, minutes, and seconds.