I need to be able to import from a csv file (which I cant change) into a mysql database dates and times that look like this in the csv = 201210021015
ie YYYYMMDDHHMM …but no seconds
when I import 201111221420 into a DATETIME I get odd results like 2020-11-11.
A TIMESTAMP format ignores the hours and minutes.
Can anyone advise please?
Use the
str_to_date()function like this:Something like this should work: