title: Import a date from a CSV to a database field
body: <p>I've a CSV file like this:</p>
  
  <pre><code>15/11/2016;1.0765;5060.8;5448;5144.9;5196.3;5259;4382.2
  16/11/2016;1.0702;5100.9;5459;5186.4;5238.3;5300;4391.8
  17/11/2016;1.0717;5063;5426;5148.3;5199.8;5262;4349.2
  18/11/2016;1.0629;5123.7;5446;5209.3;5261.4;5324;4402.6
  </code></pre>
  
  <p>I want to import this file into a database but I've some problems with date field. Which is the field type that I've to set into db? Date or datetime? In the PHP code, do I have to format the date in some way?
  I've also got a CSV file like this:</p>
  
  <pre><code>201412;1.2326;5208.8;6423;5310;5363.1;5399.8;4105.7;5250
  201501;1.1621;5002;5815.8;5112.6;5163.8;5204;3838.2;5100
  201502;1.1352;5024.2;5702;5132.3;5183.6;5230.4;3719.9;5000
  </code></pre>
  
  <p>Where the first string of every row is a date composed by year and month. E.g.
  201412 has to become 2014-12.</p>
  
  <p>I use MySQL database and phpMyAdmin; I import the csv file with a query like this:</p>
  
  <pre><code>$query = 'INSERT INTO dailycoppergg 
          (   ddmmyy,
              lmedollton,
              changedolleuro,
              euroton,
              lmesterton,
              delnotiz,
              girm,
              sgm
          ) VALUES (...)';
  </code></pre>
  
  <p>How have I to set field type into db in both cases? How have I format the string date before the db storage?</p>