title: Search by Date using Linq query
body: <p>I have Database table and it has a field call <strong>CreatedDate</strong> which is DateTime Format. </p>
  
  <p>Ex: in that field values are saved like <code>2015-08-27 13:28:50.333</code> or <code>NULL</code></p>
  
  <p>I wrote following Linq query to search by <code>type</code>, <code>category</code>, <code>country</code>,  <code>subsidary</code> and date . <code>type</code>, <code>category</code>, <code>country</code>,  <code>subsidary</code> fields are nvarchar field and date is DateTime Field</p>
  
  <pre><code>    [HttpGet]
      public JsonResult FetchProducts(string type, string category, string country, string subsidary, string dateHERE)
      {
  
          DateTime? mydate = null;
          DateTime date2;
          bool check = DateTime.TryParse(dateHERE, out date2);
          if (check)
          {
              mydate = date2;
          }
  
          ................
  
  
          if (!string.IsNullOrWhiteSpace(type))
              products = products.Where(p =&gt; p.ProductType_ID.StartsWith(type));
  
          ....................
  
          if (check)
          {
             products = products.Where(p =&gt; p.CreatedDate.Equals(mydate)).ToList();
          }
  
          ...............
  
          return Json(data, JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>once I input date and search i'm getting null </p>
  
  <p>this query is working for almost all the fields except <code>date</code> . whats the corrects linq query to search a date. </p>