By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

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

P: 2
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.
Feb 9 '08 #1
Share this Question
Share on Google+
2 Replies


mwasif
Expert 100+
P: 801
Did you look at PHP's strtotime() or MySQL's STR_TO_DATE() functions?
Feb 9 '08 #2

P: 2
Yes ive already looked at those, Dont worry I'll figure it out thanks
Feb 9 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.