title: How to use ToShortDateString in linq lambda expression?
body: <p>I need to call ToShortDateString in a linq query suing lambda expressions:</p>
  
  <pre><code>toRet.Notification = Repositories
      .portalDb.portal_notifications.OrderByDescending(p =&gt;       p.id)
      .FirstOrDefault(p =&gt; p.date.ToShortDateString() == shortDateString);
  </code></pre>
  
  <p>but I get the error:</p>
  
  <blockquote>
    <p>An exception of type 'System.NotSupportedException' occurred in
    System.Data.Entity.dll but was not handled in user code</p>
    
    <p>Additional information: LINQ to Entities does not recognize the method
    'System.String ToShortDateString()' method, and this method cannot be
    translated into a store expression.</p>
  </blockquote>
  
  <p>What can I do, considering that I do need to use <code>ToShortDateString()</code> ?</p>
  
  <p>Thanks.</p>