How to find the difference between
dates?
How can I get difference in hours between two date columns ? I found
function month_between, but it is not straightforward how to get hours
out of month. Is there any other way then coding for all 30, 31 day
months, leap years, etc?
Ans1:
Try:
select (date1 - date2) * 24 from ....
The minus of dates is the number of days between
them.
Hth
bjin
Ans2:
Hi
------------------------------------------------------------------------
select
(trunc(sysdate,'hh24')-trunc(to_date('01-01-1999','dd-mm-rrrr'),'hh24'))*24
from dual;
-----------------------------------------------------------------------------
returns how many full hours between sysdate and 1 January 1999