PHP Oracle convert date to mm/dd/yyyy from yyyy
I am displaying a date in yyyy-mm-dd format.
select id,notes,TO_CHAR(arrival_date,'yyyy-mm-dd') requested_date
from orders where id = 51;
Users change the date with a javascript pop-up calendar, then submit changes.
update orders
set arrival_date = to_date('2015-02-10','mm/dd/yyyy')
where id='51';
I replaced $requested_date
with '2015-02-10'
to test in Toad and got
ORA-(01843)not a valid month
My arrival_date is a DATE
type.
Look at the format.. You pass 2015-02-10
for format mm/dd/yyyy
that can't work. Instead use :
to_date('02/10/2015', 'mm/dd/yyyy')
链接地址: http://www.djcxy.com/p/36956.html
上一篇: 将字符串文字转换为日期