oracle计算2个时间相差多少小时

2024-10-29 03:45:39
推荐回答(1个)
回答1:

---时间差参考(具体到秒):
select Sysdate time1,to_date('20100118 14:00:00','yyyymmdd hh24:mi:ss') time2,
floor((Sysdate-to_date('20100118 14:00:00','yyyymmdd hh24:mi:ss')))||'天'||
floor(mod(trunc((Sysdate-to_date('20100118 14:00:00','yyyymmdd hh24:mi:ss'))*24),24))||'小时'||
floor(Mod((Sysdate-to_date('20100118 14:00:00','yyyymmdd hh24:mi:ss'))*1440,60))||'分'||
ROUND(Mod(((Sysdate-to_date('20100118 14:00:00','yyyymmdd hh24:mi:ss'))*1440*60),60),0)||'秒' 时间差
From dual ;