两个时间相差天时分秒

select '两个时间相差:'AS 时间,
       trunc(to_number(sysdate -to_date('2013-08-11 18:30:59','yyyy-mm-dd hh24:mi:ss')))天,       
       trunc(mod(to_number(sysdate -to_date('2013-08-11 18:30:59','yyyy-mm-dd hh24:mi:ss'))*24*60,1440)/60) 小时,       
       trunc(mod(to_number(sysdate -to_date('2013-08-11 18:30:59','yyyy-mm-dd hh24:mi:ss'))*24*60*60,3600)/60)分钟,
       trunc(mod(to_number(sysdate -to_date('2013-08-11 18:30:59','yyyy-mm-dd hh24:mi:ss'))*24*60*60,60))秒
  from dual; 

猜你喜欢

转载自blog.csdn.net/tianmingt/article/details/81807781