1.转字符串类型
select sysdate from dual; --获取Oracle系统时间
转你想要的字符串格式的时间:
select to_char(sysdate,'yyyy-MM-dd HH:mm:SS') from dual; --Oracle系统时间转字符串
2.转Date类型
①字符串转date
select to_date('2019-01-08 16:43:44','yyyy-MM-dd HH24:mi:ss') date类型时间 from dual; --字符串转date
②timestamp转date
select systimestamp from dual; --timestamp类型时间
转date类型的时间:
select to_date(to_char(systimestamp,'yyyy-MM-dd HH24:mi:ss'),'yyyy-MM-dd HH24:mi:ss') from dual
3.转timestamp类型
①字符串转timestamp类型
select to_timestamp('2019-01-08 17:17:22.1','yyyy-mm-dd hh24:mi:ss.ff') from dual; --字符串转timestamp
②date转timestamp类型
select cast(sysdate as timestamp) from dual; --date转timestamp