title: ParseExact - String was not recognized as a valid DateTime
body: <p>I'm trying to convert string variable to datetime format:</p>
  
  <pre><code>[DateTime]::ParseExact($tempdate, 'dd.MM.yyyy', [CultureInfo]::InvariantCulture).ToString('yyMMdd')
  </code></pre>
  
  <p><code>$tempdate</code> contains date in format <code>dd.MM.yyyy</code> which was obtained from an Excel file.</p>
  
  <p>Unfortunately I'm getting error message:</p>
  
  <pre>Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a
  valid DateTime."
  At line:1 char:1
  + [DateTime]::ParseExact($tempdate, 'dd.MM.yyyy', [CultureInfo]::Invaria ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : FormatException</pre>
  
  <p>It works fine when I put 'clean date' instead of variable.</p>
  
  <pre><code>[DateTime]::ParseExact('13.03.2017', 'dd.MM.yyyy', [CultureInfo]::InvariantCulture).ToString('yyMMdd')
  </code></pre>
  
  <p>What is wrong with this variable or how can I convert it to datetime in other way? </p>