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

Determine Recurrence Rule Type

1 Answer 45 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
rjb227s
Top achievements
Rank 1
rjb227s asked on 12 Feb 2010, 11:24 PM
Hi,

I have a string representation of a recurrence rule and need a way to determine the type (hourly, daily, monthly, yearly).  Are there any pre-built methods for accomplishing this.  I'm trying to avoid having to parse the rule to determine its type.

Thanks,

Ryan

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Feb 2010, 02:06 PM
Hello Ryan,

If you want to avoid parsing, you can use regular expressions. I am no expert in regular expressions, but here is a code sample that could help you get the recurrence type.
using System.Text.RegularExpressions;
  
  
public partial class Default4 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string rrule = "DTSTART:20100107T040000Z DTEND:20100107T043000Z RRULE:FREQ=WEEKLY;COUNT=10;INTERVAL=1;BYDAY=WE";
        Response.Write(Regex.Split(Regex.Split(rrule, "FREQ=")[1], ";")[0]);    
  
    }
}



All the best,
Peter
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
rjb227s
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or