Page 1 of 1

Update mysql from Excel

Posted: Wed Jun 22, 2011 2:40 pm
by Lonestarjack
I have an Excel file with a date column that looks like this -- 6/13/2011 9:43:24 PM.
I can use Excel_reader to conver the Excel file into an array and then extract the date field.
I want to use getDate to extract information like day of the week etc before posting to a mysql file.
I have tried many different ways, but can't seem to get the correct commands to be able to use the getDate function.
Is this possible?

Re: Update mysql from Excel

Posted: Mon Jun 27, 2011 12:39 pm
by Jade
You need to pass getDate a timestamp, not a formatted date. That means you'll need to use strtotime on the date before you pass it to getDate.

Re: Update mysql from Excel

Posted: Sat Jul 16, 2011 4:44 pm
by Christopher
Use strtotime() to get a timestamp first. Then you can get the parts of the date/time. You also might want to use the DateTime class.