title: Getting a list of all files with a certain date of last modified
body: <p>I'm creating a program in c# that will get hold of all the files in a given directory that were
  created on a specific date and then zip these files and store them in another directory. Sounds
  plain and simple, I have a license for Teleriks components so that takes care of the zipping business.</p>
  
  <p>BUT in order to select the files I use the following code:</p>
  
  <pre><code>        //Get all files created yesterday
          DateTime to_date = DateTime.Now.AddDays(-1);
  
          var directory = new DirectoryInfo(@"C:\Path_Of_Files");
  
          var files = directory.GetFiles()
                      .Where(file =&gt; file.CreationTime &lt;= to_date);
  
          if (files.Count() &gt; 0)
          {
            //Zipping code here
          }
  </code></pre>
  
  <p>This however gives me ALL the files in the directory, so instead of zipping 700 files, it zips all 53'000 files in the folder, which isn't what I wanted.</p>
  
  <p>When I look in the Windows Explorer I see the correct date in the "Last Modified" column, but for some reason my code refuse to acknowledge the same date. I've tried with both:</p>
  
  <pre><code>        var files = directory.GetFiles()
                      .Where(file =&gt; file.CreationTime &lt;= to_date);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>        var files = directory.GetFiles()
                      .Where(file =&gt; file.LastWriteTime &lt;= to_date);
  </code></pre>
  
  <p>Both with the same result.</p>
  
  <p>What am I doing wrong?</p>