timestamp時間格式


時間戳(timestamp),通常是一個字符序列,唯一地標識某一刻的時間。

時間戳是指格林威治時間1970年01月01日00時00分00秒(北京時間1970年01月01日08時00分00秒)起至現在的總秒數。

 

原格式(timestamp):01-1月 -00 02.30.00.000000000 下午

轉換成 to_char 格式:'yyyy-MM-dd HH24:mi:ss'

sql語句:select to_char(cast(cast(timestamp as timestamp1) as date), 'yyyy-MM-dd HH24:mi:ss') as timestamp2 from 表名;

 

date和timestamp之間的相互轉換可以通過

to_char來轉換timestamp——>date:

1 select to_date(to_char(systimestamp,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') from dual

date ——>timestamp:

1 select to_timestamp(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') from dual:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM