I have a column in my database which had dates incoming in the following format: H:m:s,d.M.yyyy. Because mysql couldn't resolve this format as a date, I was forced to set the type of this column as string. Fast forward a couple of months and a few thousand records of data now I managed to change the incoming data format as: yyyy-M-d H:m:s which mysql can interpret as date.
So now I want to change the old format H:m:s,d.M.yyyy to the new one yyyy-M-d H:m:s in 4 different tables on more than a few thausand records. After I do that I will just change the type of the column of string to date without any conflicts
So what I tried was:
UPDATE myTable
SET myColumn = REPLACE(myColumn , 'H:m:s,d.M.yyyy', 'yyyy-M-d H:m:s')
WHERE myColumn LIKE '%H:m:s,d.M.yyyy%'
But that didnt work, I also then tried this, but I think my synthax is off:
UPDATE myTable
SET myColumn = REPLACE(STR_TO_DATE(myColumn , 'H:m:s,d.M.yyyy', 'yyyy-M-d H:m:s'))
WHERE myColumn LIKE '%H:m:s,d.M.yyyy%'
Doesa anyone have any suggestions or alternate solutions?