Is there a way to get a linq query to return just the date portion of a datetime. I've tried all the suggestions I can find, all of which generate errors at runtime. This is just the select portion of the query along with each error message (the rest of the query works great):
select new { d.id, d.date.Value.Date };
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
select new { d.id, date=EntityFunctions.TruncateTime(d.date) };
The function is not recognized by SQL Server Compact. [ Name of function = TRUNCATETIME,Data type (if known) = ]
select new { d.id, date=d.date.Value.Month + "/" + d.date.Value.Day };
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
select new { d.id, date=d.date.Value.Month.ToString() + "/" + d.date.Value.Day.ToString() };
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
select new { d.id, date=String.Concat(d.date.Value.Month, "/")};
LINQ to Entities does not recognize the method 'System.String Concat(System.Object, System.Object)' method, and this method cannot be translated into a store expression.
Thanks for any help!