Are there any plans to better support DateTime in Linq to Entities?

Topics: EF Runtime
Jan 10, 2013 at 8:02 PM

Hi, i would like to know if there are chances to have following query supported:

var query = from book in context.Books
   where book.ReleaseDate.Date == new DateTime(2013, 1, 10)
   select book;

I know i can use EntityFunctions.TruncateTime, at least in EF5, but in EF6 i cannot find EntityFunctions class.

What about contributions?

Bests, Max

Jan 10, 2013 at 11:43 PM

In EF6 you can find it here:

Jan 16, 2013 at 7:15 AM

Thank you for the clarification mozzyk, but my question is still partially open, is there any chances to support Date property on DateTime and DateTimeOffset? 

Would the team be interested in any contribution in this?

Bests, Max

Jan 16, 2013 at 8:45 PM

Hi Max,

Currently adding support for Date property is not on our list - I don't think we even have a work item for this. Having said that we are always interested in contributions that improve Entity Framework. I would recommend writing a short proposal on how this would be done and we would take it from there. Note that to contribute the actual code you need to sign the CLA. You can find more details about contributing here:



Jan 23, 2013 at 8:12 AM

Hi Pawel,

I'm aware of DbFunctions, but out of the box support of some simple DateTime methods would just be more straight forward.

Imagine a case where common business conditions like Expression<Func<Customer, bool>> are reused on the client side where the EntityFramework.dll is not available. This case would be no issue when Linq to Objects and Linq to Entities could use the same default DateTime methods (see this work item).


Jan 23, 2013 at 4:54 PM

Hi Mat,

Yes, I understand that there are scenarios where this can be very useful. Unfortunately the work item you pointed to did not make it to the EF6 release. As I hinted above we take contributions and we have already taken pull requests for work items and features that were not on the list for EF6.