title: Retrieve datetime object in Powershell without the time portion
body: <p>Is it possible to retrieve only the date portion of a datetime object in PowerShell? Reason being I need to compare the <code>LastWriteTime</code> property of files with today's date to determine whether to backup a file or not. As-is a datetime object includes the time as well which will always evaluate to false when I do something like:</p>
  
  <pre><code>if ($fileDate -eq $currentDate) {
      # Do backup
  }
  </code></pre>
  
  <p>I haven't found anyway to do this. If we use the format operator or a method, it converts the object to a string object. If you try to convert that back to a datetime object, it appends the time back onto the object. Probably something simple, but I've been looking at this script for a while and that's the last part that's breaking.</p>