title: Linq compare by date problem
body: <p>My Code is here</p>
  
  <pre><code>VisitorLog log = db.Context.VisitorLogs
           .Where(vl=&gt;vl.inDate.Date == DateTime.Now.Date).FirstOrDefault();
  </code></pre>
  
  <p>this error shown</p>
  
  <p><code>The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported</code></p>
  
  <p>How to compare by only date <code>(skip time)</code> in LINQ?</p>
  
  <p><strong>CORRECT ANSWER</strong></p>
  
  <pre><code>var currentDate = DateTime.Now;
  VisitorLog log = db.Context.VisitorLogs
  .Where(vl =&gt; EntityFunctions.DiffDays(vl.inDate, currentDate) == 0).FirstOrDefault();
  </code></pre>
  
  <p>Thanks for answered.</p>