简体   繁体   English

如何在oracle / sql中将数字转换为时间戳

[英]how to convert a number into timestamp in oracle/sql

how to convert a number into timestamp(6) in oracle? 如何在oracle中将数字转换为timestamp(6)? ie convert 20131108 to 08-NOV-13 12.00.00.000000 AM or any format in timestamp(6). 例如,将20131108转换为08-NOV-13 12.00.00.000000 AM或timestamp(6)中的任何格式。 Thanks! 谢谢!

You convert your number to a string with to_char. 您可以使用to_char将数字转换为字符串。 Then you convert that string to timestamp with to_timestamp. 然后,使用to_timestamp将该字符串转换为时间戳。 Time will automatically be midnight. 时间将自动为午夜。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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