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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raindrop
    New Member
    • Feb 2008
    • 2

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

    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
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Did you look at PHP's strtotime() or MySQL's STR_TO_DATE() functions?

    Comment

    • raindrop
      New Member
      • Feb 2008
      • 2

      #3
      Yes ive already looked at those, Dont worry I'll figure it out thanks
      Last edited by raindrop; Feb 9 '08, 05:58 PM. Reason: i'll figure it out myself since no one wants to help

      Comment

      Working...