Oracle current_timestamp至秒的转换 [英] Oracle current_timestamp to seconds conversion
本文介绍了Oracle current_timestamp至秒的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们正在使用Oracle数据库.
We are using Oracle database.
在我们的表中,时间戳记自1970年以来以秒存储,如何将通过current_timestamp()函数获得的时间戳转换为秒数
In our table timestamp is stored as seconds since 1970, how can I convert the time stamp obtained through current_timestamp() function to seconds
推荐答案
这可以做到:
select round((cast(current_timestamp as date) - date '1970-01-01')*24*60*60) from dual
尽管如果我只对秒感兴趣,我不会使用current_timestamp,但我会使用SYSDATE:
Though I wouldn't use current_timestamp if I was only interested in seconds, I would use SYSDATE:
select round((SYSDATE - date '1970-01-01')*24*60*60) from dual
这篇关于Oracle current_timestamp至秒的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文