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

Recurrence Exception

4 Answers 92 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ashish Sapkale
Top achievements
Rank 1
Ashish Sapkale asked on 25 Aug 2010, 11:52 AM

Hello,

I am adding exception to Recurrence rule.

I followed this link Recurrence Rule Excpetion

1.RecurrenceRule RecurrenceRuleEvent = RecurrenceRule.TryParse(strRecurrenceRule);
2.RecurrenceRuleEvent.Exceptions.Add((Convert.ToDateTime("8/25/2009 10:00 AM").ToUniversalTime()));

I want to add Exception to "8/25/2009 10:00 AM"

But this line adding exception to "8/25/2009 04:30 AM"

I have attached Screen shot that Whats the basic problem.

The Recurrence Rule after Adding Exception.

DTSTART:20100825T090000Z
DTEND:20100825T093000Z
RRULE:FREQ=HOURLY;INTERVAL=1
EXDATE:20100825T090000Z,20100825T043000Z,20090825T043000Z

Thank you!

4 Answers, 1 is accepted

Sort by
0
Ashish Sapkale
Top achievements
Rank 1
answered on 27 Aug 2010, 06:57 AM
Please, Any help ?
0
Accepted
Nikolay Tsenkov
Telerik team
answered on 30 Aug 2010, 01:03 PM
Hello Ashish Sapkale,

Here is a quote from the reference of DateTime.ToUniversalTime() method:
"The UTC time is equal to the local time minus the UTC offset.".
That's why it's changing the value.

What you need is the SpecifyKind method of the DateTime type (here is a reference for it: http://msdn.microsoft.com/en-us/library/system.datetime.specifykind.aspx).
In order to remain the same value you can explicitly declare it as follows:
DateTime localTime = DateTime.SpecifyKind(Convert.ToDateTime("8/25/2009 10:00 AM"), DateTimeKind.Local);

Please, try that out and let me know about the results.

Hope this solves your problem!


Regards,
Nikolay Tsenkov
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
Ashish Sapkale
Top achievements
Rank 1
answered on 31 Aug 2010, 10:45 AM
1.DateTime localTime = DateTime.SpecifyKind(Convert.ToDateTime("8/25/2009 10:00 AM"), DateTimeKind.Utc);

Thanks 

This method works for me after I changed DateTimeKind to DateTimeKind.Utc.


Will this be problem If I am on different time zone ?

0
T. Tsonev
Telerik team
answered on 03 Sep 2010, 03:28 PM
Hello Ashish,

It should work regardless of the current time zone.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
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
Scheduler
Asked by
Ashish Sapkale
Top achievements
Rank 1
Answers by
Ashish Sapkale
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
T. Tsonev
Telerik team
Share this question
or