0

Getting an error when trying to correct the year portion of imported dates.

CSV Date Column Values were formatted

07/21/18 instead of 07/21/2018

This caused MySql to Insert Date as 07/21/0018

I was under the impression that year values in the range 00-69 were converted to 2000-2069 as stated in the documentation.

Any way to fix this? I've tried quite a few statements with no luck...

Any help appreciated

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236

1 Answers1

1

Assuming you want to just update the data in place, and it is a column of Date, DateTime or Timestamp types, you could do this:

UPDATE table SET date = date + INTERVAL 2000 YEAR WHERE YEAR(date) < 70
Nick
  • 138,499
  • 22
  • 57
  • 95