title: Get list of files with a specific date range
body: <p>Windows 10 x64 1709<br>
  PowerShell 5.1  </p>
  
  <p>I have a PowerShell script that recursively lists all files in a directory (and sub-directories) and outputs the list to a text file.
  I want now to get the files with LastWriteTime within a specific date range.
  I found the following as an example in other questions/sites, which should work:</p>
  
  <pre><code>(Get-ChildItem 'C:\path\to\files\raw\*.xml' -Recurse).FullName | Where-Object {
      $_.LastWriteTime -ge '01/01/2019 00:00:00' -and
      $_.LastWriteTime -le '22/04/2019 00:00:00'
  } &gt; 'C:\path\to\files\filelist.txt'
  </code></pre>
  
  <p>(date is in dd/MM/YYYY in my system, but I tried other formats as well, just in case)</p>
  
  <p>At first I thought it was an issue related to the date/time format, and I spent several hours banging my head and trying all kinds of conversions.
  I also tried using Where instead of <code>Where-Object</code>, same issue.</p>
  
  <p>I finally thought of trying something simpler: running each condition separately. And lo-and-behold, here's the deal.</p>
  
  <p>If I run the <code>-le</code></p>
  
  <pre><code>(Get-ChildItem 'C:\path\to\files\raw\*.xml' -Recurse).FullName |
      where LastWriteTime -le '22/04/2018 01:00:00'
  </code></pre>
  
  <p>I get a list of files.</p>
  
  <p>If I run the <code>-ge</code></p>
  
  <pre><code>(Get-ChildItem 'C:\path\to\files\raw\*.xml' -Recurse).FullName |
      where LastWriteTime -ge '01/01/2019 00:00:00'
  </code></pre>
  
  <p>the list is empty (no errors either).</p>
  
  <p>The following, however, does work:</p>
  
  <pre><code>(Get-ChildItem 'C:\path\to\files\raw\*.xml' -Recurse).FullName |
      where LastWriteTime -ge $Today
  </code></pre>
  
  <p>I looked for documentation on the <code>-ge</code> parameter; tried it in lower/uppercase... no go.</p>
  
  <p>Am I missing something obvious?
  Is <code>-ge</code> broken?</p>
  
  <p>PS: I tried changing <code>LastWriteTime</code> with <code>CreationTime</code> and the issue persists (not that it matters, but just mentioning it).</p>