I have a property of an entity that is of type DateTime?
and in SQL Server it is of type datetime
also. I need to make a query that sort by date, but without considering the time, because in that specific view will not show the time. Then sort by code.
Doing two sorts I get with ThenBy
, I do not know how to skip the time.
var query = contexto.Contas.OrderBy(c => c.Data).ThenBy(c => c.Codigo);
Suppose this data
001 | 12/22/2016 1:25 PM
002 | 12/22/2016 11:25 AM
003 | 12/22/2016 12:25 PM
Today is displayed like this:
002 | 12/22/2016
003 | 12/22/2016
001 | 12/22/2016
But it should look like this:
001 12/22/2016
002 12/22/2016
003 12/22/2016