Page 1 of 1

Get difference between dates in LINQ-to-Entity

Posted: Mon 12 Oct 2009 07:21
by mars
Is there possibility to get difference between two dates in LINQ-to-Entity?

Thanks

Posted: Wed 14 Oct 2009 08:54
by AndreyR
Unfortunately, there is no way to obtain the difference of two dates in LINQ to Entities.
We will investigate the possibility to implement some solution. I will let you know about the results of our investigation.

Posted: Mon 14 Dec 2009 12:20
by AndreyR
We have added the DateInterval EntitySQL function to work around this problem.
It will be available in the nearest build.

Posted: Tue 29 Dec 2009 16:04
by wfer
Is there an example of using DateInterval function?

Posted: Wed 30 Dec 2009 12:39
by AndreyR
This function is available in Entity SQL only.
Here is a sample to get the interval:

Code: Select all

select Devart.Data.Oracle.DateInterval(, ) from 
and a sample to use it in the Where method:

Code: Select all

db.Emps.Where("Devart.Data.Oracle.DateInterval(it.FIREDATE, it.HIREDATE) > @p", new ObjectParameter("p", new TimeSpan(30, 0, 0)));
Please note that this functionality will be available only in the next build.