I need to get date from datetime in linq like this:
var items = db.Students.ToList().Select(u => new { bi = u.Birthday.Date });
but items in grid are displayed as follows:
I've seen other questions:
Question1: Linq - Select Date from DateTime
but when I edit code Similarly,
var items = (from xx in db.Students
select new
{
EntityFunctions.TruncateTime(xx.Birthday)
}).ToList();
I got a error in code!!
Question2: How to get only Date from datetime column using linq
but accepted answer to this question convert date to string!
Question3: Linq to Entity get a Date from DateTime
Answers similar to question1.
aspx for show grid:
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
Does anyone have an idea to solve this problem?
Thanks.