find the elapsed time between two dates in oracle sql

后端 未结 3 933
囚心锁ツ
囚心锁ツ 2021-02-05 18:23

i need to find the difference between the time in the format hh:mm:ss

select msglog.id,max(msglog.timestamp) enddate,
   min(msglog.timestamp) startdate,
   en         


        
3条回答
  •  佛祖请我去吃肉
    2021-02-05 19:05

    To get the diff in seconds you can use this

    select round(24 * 60 * 60* (TO_DATE('2017/02/17 9:32:25', 'YYYY/MM/DD HH:MI:SS') - TO_DATE('2017/02/17 8:30:30', 'YYYY/MM/DD HH:MI:SS'))) from dual;
    

提交回复
热议问题