Oracle 日期型 将timestamp类型转换为date类型

Oracle将timestamp类型转换为date类型有三种方法

1、使用to_char先转为字符型,在使用to_date再转为日期型

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

2、使用SYSTIMESTAMP+0隐式转换

select systimestamp+0 from dual;                    --oracle会自动进行隐式转换

3、使用cast函数进行转换

select cast(systimestamp as date) from dual;
 

猜你喜欢

转载自www.cnblogs.com/xibuhaohao/p/11791000.html