微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

计算oracle数据库字符串时间秒差值

1 原始数据


select t.record_date as rq,

t.cal_current_status as curZT,
round(to_number(to_date(to_char(t.cal_current_end_time,
'yyyy/mm/dd hh24:mi:ss'),
'yyyy/mm/dd hh24:mi:ss') -
to_date(to_char(t.cal_current_begin_time,
'yyyy/mm/dd hh24:mi:ss')) * 24 * 60,
2) as curTime,
t.cal_series_status as serzt,
round(to_number(to_date(to_char(t.cal_series_end_time,
'yyyy/mm/dd hh24:mi:ss') -
to_date(to_char(t.cal_series_begin_time,
2) as serTime
from tb_lh_ug_import_status t

order by record_Date

2 格式化后数据

3 *24代表求小时差,*24*60代表求分钟差,*24*60*60代表求秒差

select to_number(to_Date('2017/8/4 0:04:14','yyyy/mm/dd hh24:mi:ss')-to_Date('2017/8/4 0:03:17','yyyy/mm/dd hh24:mi:ss'))*24*60*60 from dual;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐