Oracle 如何将“25-5月 -20 06.13.02.141000 下午”字符串转换成标准日期格式

解决方法

–转换成正常日期格式(yyyy-mm-dd hh24:mi:ss)–

select to_char(cast(cast('25-5月 -20 06.13.02.141000 下午' as timestamp) as date),'yyyy-mm-dd hh24:mi:ss') dateStr from dual;

转换结果
在这里插入图片描述
其实,上面这种格式是可通过to_timestamp函数转化过来

–转换成时间戳格式 —

select to_timestamp('2020-05-25 18:13:02','yyyy-mm-dd hh24:mi:ss') from dual;

转换结果
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/jike11231/article/details/107937941