Why does sometimes DateTime.TryParse work and other time only DateTime.ParseExact work?
<p>I have two laptops both with windows xp sp3, vs 2010 and target framework .Net 3.5. When processing DateTime variable, I found that with laptop1 </p>

<pre><code>DateTime oldOrderDate;
string strnewdate = string.Empty;
CultureInfo provider = CultureInfo.InvariantCulture;

if (DateTime.TryParse(items[1], out oldOrderDate))                                    
    strnewdate = oldOrderDate.ToString("yyyy-MM-dd");
</code></pre>

<p>returned an exception "string was not recognized as a valid datetime" , but the codes below:</p>

<pre><code>oldOrderDate = DateTime.ParseExact(items[1], "dd/MM/yyyy", provider);
strnewdate = oldOrderDate.ToString("yyyy-MM-dd");
</code></pre>

<p>works. OTOH, with laptop2, </p>

<pre><code>oldOrderDate = DateTime.ParseExact(items[1], "dd/MM/yyyy", provider);
strnewdate = oldOrderDate.ToString("yyyy-MM-dd");
</code></pre>

<p>returned an exception "string was not recognized as a valid datetime" , but the code below:</p>

<pre><code>if (DateTime.TryParse(items[1], out oldOrderDate))                                    
    strnewdate = oldOrderDate.ToString("yyyy-MM-dd");
</code></pre>

<p>works. So, my question is how I should do processing of a DateTime variable to work in both laptops. I'd really appreciate any advice you could give me. Thank's in advance.</p>
