title: Filtering DateTime in IQueryable Result
body: <p>I have an application that is displaying a list of users on a page. The client has an option to filter the users. In my repository, I have a Linq query that returns an IQueryable of User. I am applying the filter and paging to the IQueryable result and calling the .ToList(). I have not been able to get the date filtering to work properly. It does not return anything if I include the "/" as part of a date search. For example, I have a patient with DOB 07/10/2000. It returns the patient when I type "07" but nothing if I type "07/". What changes can I make to the below query, without calling .ToList() before paging, to get the date filtering to work correct?</p>
  
  <pre><code>  IQueryable&lt;User&gt; users = _db.Users.Where(x =&gt; x.UserID == userID &amp;&amp; x.Active == true);
  
    if (!string.IsNullOrWhiteSpace(param.filterValue))
              {
                  users = users.Where(x =&gt; x.firstName.ToLower().Contains(param.filterValue.ToLower())
                   || x.lastName.ToLower().Contains(param.filterValue.ToLower())
                   || x.dateOfBirth.ToString().Contains(param.filterValue.ToLower())
                  );
              }
  </code></pre>
  
  <p><strong>Updated 08/17/2018</strong></p>
  
  <p>dateOfBirth is a DateTime field. However, the time is being ignored. The param.filterValue is an instance of the Parameters class shown below. It contains the value that is entered in the search box. </p>
  
  <pre><code>public class Parameters
  {
      public int MAX_PAGE_SIZE {
          get {
              return 100;
          }
      }
      public string filterValue { get; set; }
      public int PageIndex { get; set; }
      public int PageSize { get; set; }
  }
  </code></pre>
  
  <p>Also, I try it with this change.</p>
  
  <pre><code>x.dateOfBirth.ToString("MM/dd/yyyy").Contains(param.filterValue.ToLower())
  </code></pre>
  
  <p>It throws an exception</p>
  
  <p><em><code>LINQ to Entities does not recognize the method 'System.String ToString(System.String)' method, and this method cannot be translated into a store expression.</code></em></p>