How can I show interval between 2 timestamps in 'hh24:mi' format?
I have a Table with two Datestamps StartTime
and EndTime
between which I would like to see the difference in Hours and Minutes as HH24:mi
The difference is never above 24 hours but StartTime
can be on day 1 and EndTime
can be on day .
Example :
StartTime = 19/02/2019 22:52:42
EndTime = 20/02/2019 02:56:42
Result wanted = 04:04
So far the best results I managed to have are :
4,8 : ROUND ((EndTime - StartTime) * 24,2) INTERVAL
4:4 : EXTRACT (hour from numtodsinterval (EndTime - add_months (StartTime, floor (months_between (EndTime,StartTime))), 'day')) || ':'
|| EXTRACT (minute from numtodsinterval (EndTime - add_months (StartTime, floor (months_between (EndTime, StartTime))), 'day'))
Hours & Minutes in a seperate field : Hrs : 4 | Min : 4
trunc(((86400*(EndTime-StartTime))/60)/60)-24*(trunc((((86400*(EndTime-StartTime))/60)/60)/24)) "Hrs"
trunc((86400*(EndTime-StartTime))/60)-60*(trunc(((86400*(EndTime-StartTime))/60)/60)) "Min"