ora 01830 日期格式图片在转换整个收入字符串

to_date是类型转换,不是格式转换,字符串和后面的格式要匹配;to_char才是用来 转成对应格式;

以下面实际例子进行说明:

var newDate:='2018-09-29 11:10:30';

1、select to_date(&newDate,'yyyy-mm-dd hh24:mi:ss') from dual;

2、select to_date(&newDate,'yyyy-mm-dd') from dual;

3、select to_date(substr(&newDate,1,13),'yyyy-mm-dd hh24') from dual;

4、select to_char(to_date(&newDate,'yyyy-mm-dd hh24:mi:ss') ,'yyyy-mm-dd hh24') from dual;

猜你喜欢

转载自blog.csdn.net/goto1997/article/details/82884533
今日推荐