Search This Blog

Total Pageviews

Monday, 2 January 2012

Oracle Subtract dates times

 


select trunc(mydate / 3600) myhour,trunc(mod(mydate, 3600) / 60) myminute,mod(mydate, 60) mysecond
from (select round((to_date('02-01-2012 11:00:34','dd-mm-yyyy hh24:mi:ss') - to_date('02-01-2012 5:12:00','dd-mm-yyyy hh24:mi:ss')) * 86400) mydate from dual)


   MYHOUR   MYMINUTE   MYSECOND
---------- ---------- ----------
5 48 34

 

Oracle DBA

anuj blog Archive