title: How to convert Get-WinEvent's TimeCreated to yyyy-MM-dd-hh-mm-ss format?
body: <p>In PowerShell 2.0 on Windows 7 I can format time/date format as the following:</p>
  
  <pre><code>Get-Date -format yyyy-MM-dd-HH-mm-ss
  </code></pre>
  
  <p>and output is:</p>
  
  <pre><code>2016-06-07-01-04-16
  </code></pre>
  
  <p>But now I have the following command:</p>
  
  <pre><code>Get-WinEvent -max 1 | Select-Object TimeCreated, Id
  </code></pre>
  
  <p>and the output is:</p>
  
  <pre><code>7.6.2016 13:01:46   444
  </code></pre>
  
  <p>Note: 444 is the Id column, not important in our case.</p>
  
  <p>How to format it with <code>yyyy-MM-dd-HH-mm-ss</code> to get:</p>
  
  <p><code>2016-06-07-13-01-46 444</code></p>