首页 > 数据库技术 > 详细

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

时间:2015-07-31 06:34:23      阅读:688      评论:0      收藏:0      [点我收藏+]

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计算两个时间戳相差秒数,精确到毫秒

原文:http://www.cnblogs.com/mellowsmile/p/4691076.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!