This is a migrated thread and some comments may be shown as answers.

Server DateTime.AddDays()

11 Answers 197 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris Williams
Top achievements
Rank 1
Chris Williams asked on 13 Dec 2009, 08:09 PM
Hi, I know it's not implemented, but I just wanted to let you know I ran into this limitation so that you can prioritize it for implementation in the future.  I'll implement on the client for now.

Execution of 'System.DateTime:AddHours(Double)' on the database server side currently not implemented.

In the linq query:
            var accounts = from a in Scope.Extent<Account>()
                           where a.LastTransaction < DateTime.Now.AddHours(-6) && !string.IsNullOrEmpty(a.Password)
                           select a;
            return accounts;



11 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 14 Dec 2009, 09:52 AM
Hello Chris Williams,

We are aware of the problem, it is already on our TODO list. As per your request, we will raise the priority. Thank you for the vote.

Regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Markus
Top achievements
Rank 2
answered on 30 Dec 2009, 10:00 AM
Same here.

Vote for it :-)

Regards Markus
0
Thomas
Telerik team
answered on 30 Dec 2009, 04:46 PM
Hi Markus Berchtold,

 we got your request...

Meanwhile, you can just calculate the resulting value on the client side and use this value as a parameter (removing the calculation from the LINQ query):

var later = DateTime.Now.AddHours(-6);

var accounts = from a in Scope.Extent<Account>()
where a.LastTransaction < later && !string.IsNullOrEmpty(a.Password)
select a;
return accounts; 

Best Regards,

Thomas
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 26 Apr 2010, 07:17 PM
Is this feature in yet?...I mean for the next release
0
Thomas
Telerik team
answered on 28 Apr 2010, 11:17 AM
Hello Steve,

at the moment this is not pushed yet. We've implemented the Date property however, so we could do something like

from x in Persons where x.Birthday.Date >= new Date(x.Marriage.Year-18, x.Marriage.Month, x.Day) select x; 

to find all Persons that married before they were 18.

I have filed an entry for such a feature.

Sincerely yours,
Thomas
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 28 Apr 2010, 08:49 PM
When you do impliment it, can you also add in .ToString("<date format>") please?
0
Thomas
Telerik team
answered on 29 Apr 2010, 03:23 PM
Hello Steve,

hmm, I would be willing to support DateTime.ToString() to invoke the default behavior in the server, but I'm not convinced yet that ToString("complicated fomat") should be pushable to the server. At the end, we need to consider database systems specifics here. 

Regards,
Thomas
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 30 Apr 2010, 01:21 PM
Ok thanks, the need was to check a date string against a search value passed in...so if the user searched for Wednesday or Wed I was wanting to match that...
0
Thomas
Telerik team
answered on 03 May 2010, 08:43 AM
Hello Steve,

so at the end is it more about supporting a way to express the DateTime.DayOfWeek property?
What else is required?

Sincerely yours,
Thomas
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 03 May 2010, 01:11 PM
Well more about allowing a freeform search of any date value...so I wanted to open the DateTime up to a full string date format (so Sunday, January, Dec, December, etc etc)...I have users who see\use dates differently (lots of nationalities)
0
Thomas
Telerik team
answered on 03 May 2010, 08:13 PM
Hello Steve,

I'm not really convinced that this is a fantastic idea: I'm from Germany and would write Dezember so no 'american english speaking' database server  would give me the right answer in this case, as all would return some form of dec, Dec, December etc.. 
In this case, a DateTime.DayOfWeek == System.DayOfWeek.Tuesday seems preferrable to me.

Greetings,
Thomas
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
LINQ (LINQ specific questions)
Asked by
Chris Williams
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Markus
Top achievements
Rank 2
Thomas
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or