字符串转timestamp:
update tb_a t set t.upd_timestamp=to_timestamp('2012-12-12 12:12:12.0','yyyy-mm-dd hh24:mi:ss.ff') where t.id='1'
timestamp转字符串:
select to_char(t.upd_timestamp,'yyyy-mm-dd HH24:mi:ss:ff') from tb_a t
本文介绍如何在SQL中将字符串转换为timestamp类型,并反向转换的方法。包括使用to_timestamp进行正向转换,以及利用to_char进行逆向转换的具体SQL语句。
字符串转timestamp:
update tb_a t set t.upd_timestamp=to_timestamp('2012-12-12 12:12:12.0','yyyy-mm-dd hh24:mi:ss.ff') where t.id='1'
timestamp转字符串:
select to_char(t.upd_timestamp,'yyyy-mm-dd HH24:mi:ss:ff') from tb_a t
1313

被折叠的 条评论
为什么被折叠?