Jump to content

Importing dates from excel to MySql to PHP.


webmaster1

Recommended Posts

The mysql STR_TO_DATE() function can produce a DATETIME value from any other data/time format.

 

Your use of YYYY/MM/DD should have worked, depending on if the MM/DD had leading zero's and what your code actually was doing.

I've imported the csv file using import on phpmyadmin but the dates are showing in zero's.

 

Despite formating the dates correctly in excel, csv insists on formatting the date as 4/13/2010  12:00:00 AM.

 

How do I correct this?

Found a quirky solution:

http://forums.devshed.com/mysql-help-4/import-csv-date-to-mysql-673242.html

 

Apparently, each time the csv file is open, the format of the date is reset. In other words, once the csv file is saved from excel, it can't be opened in excel prior to uploading it.

 

I'm just glad to find the solution. I'd never have guessing that thiswas the issue.  :o

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.