Ignore time portion of datetime in a LINQ to Entity Framework query

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
How can I do a LINQ to Entity Framework query where you ignore the time portion of a datetime column? Using something like MyTable.MyColumn.Date is not supported when using LINQ TO EF (think it works with LINQ to SQL) and as far as I know you cant use a Convert/cast like you can in normal SQL (or can you?) 

I need this in the where statement trying to do something like "... where mytable.datecolumn = (select min(datecolumn) ...) " but ignoring timepart (want to select all rows where date is same as the date returned from the subquery).

View the full article
 
Back
Top