title: Convert Custom String format to Date object
body: <p>At my work, I'm getting some dates from AD attributes that were set by other scripts in the company, but to a unfriendly format I would say.</p>
  
  <p>The Strings are the following: 201710191528
  Which Stand to: YYYYMMDDHHmm</p>
  
  <p>I want to convert this to a Date Object but so far without success. </p>
  
  <p>I though about using StringBuilder to manipulate the String first to a format I can use on Get-Date() doing the following:</p>
  
  <pre><code>$strB = New-Object System.Text.StringBuilder
  $strB.Append("201710191528")
  $strB.Insert(10,":")
  $strB.Insert(8," ")
  $strB.Insert(6,"-")
  $strB.Insert(4,"-")
  </code></pre>
  
  <p>And this works. StringBuilder will have "2017-10-19 15:28" which is perfect for Get-Date where I can just use it will work.</p>
  
  <p>Now, I will be processing thousands of strings like this regularly.
  Is there something more efficient? 
  I couldn't to get it to work with string formats.</p>
  
  <p>Thank you very much. </p>