I have this column in a dataset:
order_date
'2009-01-02'
'2009-01-05'
'2009-01-05'
'2009-01-05'
'2009-01-06'
'2009-01-10'
'2009-01-10'
'2009-01-11'
The dates are in string format so I'm trying to convert them to date format in MySQL workbench using:
UPDATE orders SET order_date = STR_TO_DATE(order_date, '%d-%m-%Y');
But this keeps throwing up this error message:
Error Code: 1411. Incorrect datetime value: '2010-10-13' for function str_to_date
I thought I had the format wrong so I amended the code to '%Y-%m-%d' but that doesn't seem to do anything and just returns:
0 row(s) affected Rows matched: 5506 Changed: 0 Warnings: 0
and the changes don't seem to be taking effect, as querying the datatype shows Type as 'text.'
I'm aware this question has been asked here before and I tried using the solutions like this one but it doesn't seem to work. It looks like there may be some issue with the entries where the date is '2010-10-13' but I can't seem to figure out the solution.
Please let me know where I'm going wrong or what I'm missing. Thanks in advance.