title: Comparing dates in query using LINQ
body: <p>I have a Linq query that returns to a var type myQry</p>
  
  <pre><code>var myQry = from .....
  </code></pre>
  
  <p>This is a large linq returns all the records that I need to filter further. In one of my if-conditions I have a filter that runs like this to check against date. I need to check if name contains the name entered and matches the birthdate exactly. </p>
  
  <p>I tried this which compiled and ran, but did not work correctly</p>
  
  <pre><code>myQry.Where(x =&gt; x.FirstName.Contains(strName) &amp;&amp; DateTime.Compare( x.BirthDt, searchDt)&gt;=0).ToList()
  </code></pre>
  
  <p>Then I tried this which gave threw an exception "DbArithmeticExpression arguments must have a numeric common type"</p>
  
  <pre><code>myQry.Where(x =&gt; x.FirstName.Contains(strName) &amp;&amp; (x.BirthDt- searchDt).Days == 0).ToList();
  </code></pre>
  
  <p>For such kind of a situation when I use a where clause on my query, what would be the best way to do a date comparison? What kind of operations are not allowed in the where clause of a LinQ query?</p>
  
  <p>Thanks for your time...</p>