0

I have the following csv

January,December,,,Blaize,Wildsights,Blaize,Wildsights,61,1,30,,,,,,,,,,10/09/2013 20:10:52,10/09/2013 20:11:05
January,December,,,Michael,Wildsights,Michael,Wildsights,61,2,31,,,,,,,,,,10/09/2013 20:11:03,10/09/2013 20:11:05
........
....
..

After importing it using phpmyadmin I saw that the timestamps have not been imported.

enter image description here

If it is not possible to keep the timestamps as 00/00/0000 00:00:00 how can I convert datetime automaticaly from 00/00/0000 00:00:00 format to 0000-00-00 00:00:00 format on CSV. I have thousand rows

Cœur
  • 37,241
  • 25
  • 195
  • 267
Johnny
  • 1,685
  • 6
  • 24
  • 42

1 Answers1

1
  1. Add a tempDate column of NVARCHAR type to your mySql database.
  2. import your CSV telling phpmyadmin to import your problematic dates into the tempDate column instead of your actual date column. This will succeed, because tempDate is NVARCHAR, so it will accept anything.
  3. Consult this: how to convert a string to date in mysql? on how to execute an UPDATE statement on your database to populate your actual date column from the tempDate column.
  4. remove the tempDate column.
Community
  • 1
  • 1
Mike Nakis
  • 56,297
  • 11
  • 110
  • 142