We imported a table, most probably from an Excel file, where a DATETIME, saved in a varchar, has a format that looks like this:
12/06/2003 07:42
Is there any way to convert that into a valid MySQL date format for later convert the field from varchar to DATETIME? Maybe with a regular expression? Note that 12 is the day and 06 the month.
2003-06-12 07:42:00
Thanks
CodePudding user response:
You would use str_to_date for this:
select str_to_date('12/06/2003 07:42','%d/%m/%Y %H:%i')