你的位置:首页 > 软件开发 > 数据库 > Oracle计算两个时间戳相差秒数,精确到毫秒

Oracle计算两个时间戳相差秒数,精确到毫秒

发布时间:2015-07-31 03:00:18
with t as (select to_timestamp(2015-01-01 11:13:15.023456, yyyy-mm-dd hh24:mi:ss.ff9) t1, to_timestamp(201 ...

with t as

(select to_timestamp('2015-01-01 11:13:15.023456',

'yyyy-mm-dd hh24:mi:ss.ff9') t1,

to_timestamp('2015-01-01 12:13:15.123556',

'yyyy-mm-dd hh24:mi:ss.ff9') t2

from dual)

select abs((trunc(t1 - 0, 'mi') - trunc((t2 - 0), 'mi')) * 24 * 60 * 60 +

extract(second from t1 - t2))

from t

输出结果: 3600.1001


原标题:Oracle计算两个时间戳相差秒数,精确到毫秒

关键词:oracle

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录