Get difference between dates in LINQ-to-Entity

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
mars
Posts: 17
Joined: Tue 14 Jul 2009 13:56

Get difference between dates in LINQ-to-Entity

Post by mars » Mon 12 Oct 2009 07:21

Is there possibility to get difference between two dates in LINQ-to-Entity?

Thanks

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 14 Oct 2009 08:54

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 14 Dec 2009 12:20

We have added the DateInterval EntitySQL function to work around this problem.
It will be available in the nearest build.

wfer
Posts: 1
Joined: Tue 29 Dec 2009 15:55

Post by wfer » Tue 29 Dec 2009 16:04

Is there an example of using DateInterval function?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 30 Dec 2009 12:39

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.

Post Reply