title: Parsing "mm/dd/yy" string to "mm/dd/yyyy" date object in C#
body: <p>I am working on an ASP.NET Mvc application with C# and facing a problem when I try to upload a .CSV file in order to save its data to database. </p>
  
  <p>The problem comes from the date column of the .CSV file. There are two formats of date used in that column. The first one is "mm/dd/yyyy" that I have no problem to parse to a DateTime object by the following code:</p>
  
  <pre><code>// for the date : 09/30/2014
  DateTime tempo = Convert.ToDateTime("09/30/2014");
  </code></pre>
  
  <p>The second format is "mm/dd/yy". The same method above doesn't work for this format and throws an exception </p>
  
  <pre><code>// for the date : 09/30/14
  DateTime tempo = Convert.ToDateTime("09/30/14");
  // this line throws ;
  // [09/30/14] String was not recognized as a valid DateTime. exception
  </code></pre>
  
  <p>Is there a solution which works for both of date formats ? </p>
  
  <p>Thanks for your help. </p>