数据库中的时间

关于毫秒
Oracle毫秒的存储必须字段类型为 timestamp(6) –数字表示存储的毫秒位数
--当前毫秒级时间
select to_char(current_timestamp,'yyyy-mm-dd hh24:mi:ss.ff6') from dual;
--字符串转为 timestamp类型
select to_timestamp('2012-02-03 10:29:46.453234','yyyy-mm-dd hh24:mi:ss.ff6') from dual;
--timestamp转为字符型
select to_char(systimestamp,'yyyy-mm-dd hh24:mi:ss.ff6') from dual;

PS: ff后面的数字表示获得的毫秒位数,默认是6;一般ff3 获得三位毫秒数

猜你喜欢

转载自www.cnblogs.com/wwjd365/p/9341847.html