Truncate/Ignore time part from DateTime column in Entity Framework
There are times when you want to perform query on only date part of the column that has type DateTime in database. Entity framework does not support DateTime.Date property but provides a helper class EntityFunctions . EntityFunctions has a method TruncateTime that can be called in Linq2Entities query and truncates the time part from datetime. Here is how to use it
using (AccountEntities dal = new AccountEntities ()) { transactions = (from t in dal.Transactions where EntityFunctions.TruncateTime(t.TransactionDate.Value) >= dtStart && EntityFunctions.TruncateTime(t.TransactionDate.Value) <= dtEnd orderby t.TransactionDate descending select t).ToList<Transaction>(); }












