title: C# Date in CSV file
body: <p>I have to  change a csv file with several dates in it. Every row starts with a date followed whith data.
  11-nov-2015,data,data,data
  10-nov-2015,data,data,data
  9-nov-2015,data,data,data</p>
  
  <p>With the following code I put the data in the right place (20141109 (yyyymmdd))</p>
  
  <pre><code>string[] values = lines1[i].Split(',');
  
  if (values.Length &gt;= 3)
  {
      string[] parts = values[0].Split('-');
      if (parts.Length == 3)
      {
          values[0] =  String.Format("{0}-{1}-{2}", parts[2], parts[1], parts[0]);
          lines1[i] = String.Join(",", values);
      }
  }
  </code></pre>
  
  <p>But two problems remain:
  1) The month has to change from nov to 11</p>
  
  <p>2) In the file I download the day for example 9-nov-2014 has to change to 09. for 8-nov-2014 to 08. So an extra 0. </p>
  
  <p>How can this be solved in C#</p>