您的位置:首页 > 数据库 > Oracle

How to convert timestamp to oracle Date type

2010-09-02 16:04 661 查看
How to convert timestamp(milliseconds to 1970-1-1) to oracle Date type

* convert timestamp to date

select to_date( '1970-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')+ 3600000
/86400000 as timestamp from dual

timestamp

-----------------------------

1970-01-01 01:00:00.0

* convert date to timestamp

select (to_date('2010-09-01 16:00:00','yyyy-mm-dd hh24:mi:ss')
- to_date('1970-01-01','yyyy-mm-dd'))*86400000 as aDate from dual

aDate

-----------------------------

1283356800000

Note: 86400000 = 24*60*60*1000 (total milliseconds of one day)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐