Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Need to calc time between to dates in hours and minutes
I need to calculate the difference between two dates and represent them in a
query in hours and minutes. Additionally, I need to aggregate them into a
column to use in calculating averages. Will be used in a PL/SQL package. I
have used this below in my query and it works but it is not accurate:
start_dt = 16-JUL-99 15:10:00
end_dt = 16-JUL-99 15:41:00
select to_char((end_dt-start_dt)*(24*60),'990.99') elapsed from tablex;
returned valued is 30.90
The value I would like to see is 0:31 for 0 hours and 31 minutes.
I will appreciate all help. Received on Fri Jul 16 1999 - 22:26:41 CDT