简体   繁体   中英

how to convert a number into timestamp in oracle/sql

how to convert a number into timestamp(6) in oracle? ie convert 20131108 to 08-NOV-13 12.00.00.000000 AM or any format in timestamp(6). Thanks!

You convert your number to a string with to_char. Then you convert that string to timestamp with to_timestamp. Time will automatically be midnight.

select to_timestamp( to_char(20131108) ,'yyyymmdd') from dual

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM