title: MySQL CSV import: datetime value
body: <p>I have been banging my head against a wall trying to import datetime values from a .csv file.</p>
  
  <p>Here's the import statement.</p>
  
  <p><code>
  LOAD DATA LOCAL INFILE 'myData.csv' 
                  INTO TABLE <code>equity_last_import</code>
                  FIELDS TERMINATED BY ','
                  LINES TERMINATED BY '\n'
                  (equity,last,@last_date) 
                  SET last_date = STR_TO_DATE( @last_date, '%Y-%m-%d %H:%i:%s')
  </code></p>
  
  <p>Here's a sample of the data:</p>
  
  <pre>
  4108,48.74,"2013-09-16 16:15:04"
  4249,8.1,"2013-09-16 16:15:04"
  4197,3.81,"2013-09-16 17:20:00"
  4139,26.81,"2013-09-16 16:15:04"
  4218,24.83,"2013-09-16 17:20:00"
  4260,79.72,"2013-09-16 16:15:04"
  4270,450.12,"2013-09-16 17:20:00"
  4242,30.38,"2013-09-16 16:15:04"
  4193,1.42,"2013-09-16 16:15:04"
  4134,3.77,"2013-09-16 16:15:04"
  </pre>
  
  <p>I am able to import date values using <code>STR_TO_DATE()</code> but I not able to get datetime values to import.  I have tried several different date formats other than '%Y-%m-%d %H:%i:%s' and I always get a null datetime [0000-00-00 00:00:00].  I have also tried not using <code>STR_TO_DATE()</code>, since the string is in the default MySQL datetime format. </p>
  
  <p>Any help will be appreciated.</p>