Connecting Tech Pros Worldwide Help | Site Map

Date as Text from csv insert into mySQL using PHP help please

Newbie
 
Join Date: Feb 2008
Posts: 2
#1: Feb 9 '08
Hello,

I am importing a csv file into mysql which imports nicely except for the date.
The csv file has a date column with the date fields looking like this:

Jan 13 2008 6:52PM

When I import the csv to mysql the date comes out like: 0000-00-00 00:00:00

Is there anyway I can get all the dates in the csv of this format "Jan 13 2008 6:52PM" to import this way "01-13-2008 18:52:00" ?

Can someone please guide me on how to write this in php so it will import correctly? I've been trying to figure it out for ages and looking everywhere for a solution to no avail.

Thanks in advance.
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 718
#2: Feb 9 '08

re: Date as Text from csv insert into mySQL using PHP help please


Did you look at PHP's strtotime() or MySQL's STR_TO_DATE() functions?
Newbie
 
Join Date: Feb 2008
Posts: 2
#3: Feb 9 '08

re: Date as Text from csv insert into mySQL using PHP help please


Yes ive already looked at those, Dont worry I'll figure it out thanks
Reply