title: LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)' method
body: <p>Hello This is my first post here </p>
  
  <p>I'm facing some issue with EF , I have tried the following code in VS 2010 with EF 5 and 6.</p>
  
  <p>I have table called <strong>MYTABLE</strong> and field <strong>ReveivedTime</strong> which varchar(255) but this has Datetime values like <strong>"4/29/2014 12:00:00 AM"</strong>. 
  Note : I can not change the DataType and I can not write SP to Convert , I do have limitations, So I do have option to work with LAMBDA</p>
  
  <p>I have tired the following code in <strong>LINQPad 4</strong>  itis working fine  but the same is not working in VS2010 with EF 5/6.</p>
  
  <p>getting error </p>
  
  <p><strong>LINQ to Entities does not recognize the method 'System.DateTime ToDateTime(System.String)' method, and this method cannot be translated into a store expression.</strong></p>
  
  <p><strong>Convert.ToDateTime(si.ReceivedTime)</strong> is causing the problem</p>
  
  <pre><code>   MYTable
    .Where (
        si =&gt; 
              ((Convert.ToDateTime(si.ReceivedTime) &gt;= DateTime.Now.AddDays(-10)) &amp;&amp; 
                 (Convert.ToDateTime (si.ReceivedTime) &lt;= DateTime.Now)
              )
     )
     .GroupBy (g =&gt; new 
                      {
                          Day = Convert.ToDateTime(g.ReceivedTime).Day,
                          Month = Convert.ToDateTime(g.ReceivedTime).Month,
                          Year = Convert.ToDateTime(g.ReceivedTime).Year,
                          City = g.City,
                      })
     .Select (
        g =&gt; 
           new  
           {
             Count = g.Count(),
             g.Key.Day,
             g.Key.Month,
             g.Key.Year,
             g.Key.City,
             Date = Convert.ToDateTime(g.Key.Year  + "/" + g.Key.Month + "/" + g.Key.Day),
           }
     )
     .OrderBy(x =&gt; x.Count)
  </code></pre>
  
  <p>Really appreciate your solution and advanced thanks too.</p>