Is it possible to construct a query in which I can retrieve week day name from a date into a separate column or variable?
I know I can very easily do this on .NET side but would like it to be in the query.
Is it possible to construct a query in which I can retrieve week day name from a date into a separate column or variable?
I know I can very easily do this on .NET side but would like it to be in the query.
On
You can also use SqlFunctions...
var results=context.Listings
.Select(l=>System.Data.Entity.SqlServer.SqlFunctions.DateName("dw",l.modify_date));
Of course, this only works when using a SQL Server. Methods that are cross-database, would be to use EntityFunctions.DateDiff with a known date to get the number of days between whatever and a known prior sunday, then modulus 7, then convert to a string.
It is possible you will need to build your query which returns day names and then join to your result on day number
The result of this will be