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:
How can I fix it?
Thanks.
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:
How can I fix it?
Thanks.
The Method string.Format
can't betranslated into a SQL statement. But you can materialize the rows first .ToList()
and string.Format
afterwards.
var items = db.Students.ToList().Select(u => new { bi = string.Format("{0:MM/dd/yyyy}", u.Birthday) });