title: Convert a string to datetime in PowerShell
body: <p>I am using PowerShell to try and convert a string to a datetime. It should be easy, right?</p>
  
  <p>I am getting the string from a CSV import, and it comes in the format of <code>Jul-16</code>. I have tried multiple ways of getting it into the format I want which is <code>yyyy-MM-dd</code> and I am currently at the following.</p>
  
  <pre><code>$invoice = $object.'Invoice Month'
  $invoice = "01-" + $invoice
  $invoice = [datetime]::parseexact($invoice, 'yyyy-MM-dd', $null)
  </code></pre>
  
  <p>But I get the error:</p>
  
  <blockquote>
    <p>String was not recognized as a valid DateTime.</p>
  </blockquote>
  
  <p>Am I missing something?</p>