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

use*_*737 2 sql oracle

如何在oracle中将数字转换为timestamp(6)?例如,将20131108转换为08-NOV-13 12.00.00.000000 AM或timestamp(6)中的任何格式。谢谢!

Tho*_*ner 5

您可以使用to_char将数字转换为字符串。然后,使用to_timestamp将该字符串转换为时间戳。时间将自动为午夜。

select to_timestamp( to_char(20131108) ,'yyyymmdd') from dual
Run Code Online (Sandbox Code Playgroud)