oracle sql 时间差



select  floor( (t.READ_TIME-t.ISSUED_TIME)* 24 * 60) , t.READ_TIME,t.ISSUED_TIME,
t.*  
from   DUAL t 


获取分钟数 floor是向下取整数 ceil是向上取整数

同理

两时间的相差秒数

floor( (t.READ_TIME-t.ISSUED_TIME)* 24 * 60*60)

获取毫秒差:
select ceil((To_date('2008-05-02 00:00:00' , 'yyyy-mm-dd hh24-mi-ss') - To_date('2008-04-30 23:59:59' , 'yyyy-mm-dd hh24-mi-ss')) * 24 * 60 * 60 * 1000) 相差豪秒数 FROM DUAL;

猜你喜欢

转载自cuityang.iteye.com/blog/2348838