title: Getting error : String was not recognized as a valid DateTime in c#
body: <p>Getting error like :</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: String was not recognized as a valid DateTime.</p>
  </blockquote>
  
  <p>I am using this code :</p>
  
  <pre><code>string datetime = DateTime.Parse(encrypt[1]);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>string datetime = Convert.ToDatetime(encrypt[1]);
  </code></pre>
  
  <p><strong>encrypt is a string array</strong></p>
  
  <p>In <code>encrypt[1]</code> I am <code>not sure which format will come in string</code>. i have trace some time come <code>dd/MM/yyyy</code> and sometime <code>MM/dd/yyyy</code> or  <code>MM-dd-yyyy</code> or <code>dd-MM-yyyy</code>. I am not sure about format it may from above or another format come.</p>
  
  <p>also use <code>ParseExcept</code> and <code>TryParseExcept</code>. but not get succeeded seems return same error</p>
  
  <p>please give me proper solution.</p>