title: Trying to parse a DateTime in C#
body: <p>I am trying to parse a <code>DateTime</code> in C# and have the following lines of code:</p>
  
  <pre><code>string dt =Convert.ToString( DateTime.FromFileTime(e8.sts[counter8].TimeStamp));
  string format = "dd-MM-yyyy HH:mm:ss";
  DateTime dateTime = DateTime.ParseExact(dt, format,CultureInfo.InvariantCulture);
  </code></pre>
  
  <p>When I debug <code>dt</code> is coming in as <code>05/18/2011 09:25:17 AM</code> but I get an expection saying:</p>
  
  <blockquote>
    <p>String was not recognized as a valid
    DateTime.</p>
  </blockquote>