datetime - Changing mysql date from an invalid date format -


i had date data in excel dd-mm-yy h:i:s format, mistakenly imported mysql default format %y-%m-%d %h:%i:%s date wrong now, 31-01-13 00:00:00 became 2031-01-13 00:00:00 can't import again excel need mysql query change date within column.

thanks farness

concatenating substrings date should work 2000s. 1900s, need if.

first verify dates select:

select concat(  '20',   substr(date, 9, 2),   '-',  substr(date, 6, 2),  '-',  substr(date, 3, 2),  ' ',  time(date) ) table 

then can update columns in place:

update table set date=concat(  '20',   substr(date, 9, 2),   '-',  substr(date, 6, 2),  '-',  substr(date, 3, 2),  ' ',  time(date) ) 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -