Oracle 计算两个日期相差天时分秒
时间:2021-07-01 10:21:17
帮助过:16人阅读
startTime, endTime, tday, thour, tminute,
round((tt_minute
-tminute)
*60)
as tseconds
from
(
select startTime, endTime, tday, thour, trunc((tt_hour
-thour)
*60)
as tminute, (tt_hour
-thour)
*60 as tt_minute
from
(select startTime, endTime, tday, trunc((tt_day
-tday)
*24)
as thour, (tt_day
-tday)
*24 as tt_hour
from
(select to_number(endTime
- startTime)
as tt_day,
trunc(to_number(endTime - startTime))
as tday, startTime, endTime
from
(select to_date(
‘2012-11-01 00:20:31‘,
‘yyyy-mm-dd hh24:mi:ss‘)
as startTime,sysdate
as endTime
from dual)
)
)
)
View Code
Oracle 计算两个日期相差天时分秒
标签:for src target to_char ocs 字符串 function 类型 doc