how to make phpMyAdmin import datetime correctly from csv?
I was just able to do this by changing the date fields to Custom format yy-mm-dd. ( FORMAT > CELLS > Custom > yy-mm-dd.
I had to save it as an XLS but was able to import it correctly directly into the table using PHPMyAdmin version 3.3.10
If you have the file in a CSV format open it up into excel.
- Right click the column heading that contains the dates.
- Select Format Cells
- Click the "Custom" category
- Paste "yyyy-mm-dd h:mm:ss" in the input box.
- Save the document.
- Import into table using phpMyAdmin
If at all possible, I'd import those values into a varchar column fake_column
first, and then push them over into the real column real_column
using STR_TO_DATE
.
UPDATE tablename SET real_column = STR_TO_DATE(fake_column, '%m/%d/%Y');
Reference on how to build the format string