Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Expand RFC-2445 (iCalendar) recurrence rule?

Reply
Thread Tools

Expand RFC-2445 (iCalendar) recurrence rule?

 
 
Roy Smith
Guest
Posts: n/a
 
      05-08-2012
Does there exist a stand-alone module to expand RFC-2445 recurrence
rule? The idea is to start with a string like:

"RRULE:FREQ=WEEKLY;COUNT=6;INTERVAL=2;BYDAY=FR "

and derive a list of dates on which that event occurs.

I'm aware of http://codespeak.net/icalendar/, but that solves a much
larger problem (parsing ics files) and I can't see how to tease out just
this one function from that module.
 
Reply With Quote
 
 
 
 
Roy Smith
Guest
Posts: n/a
 
      05-08-2012
O.B. Murithi suggested I look at http://labix.org/python-dateutil, which turns out to have exactly what I'm looking for. Thanks!

from dateutil.rrule import rrulestr
from dateutil.parser import parse

rule = rrulestr("FREQ=WEEKLY;COUNT=6;INTERVAL=2;BYDAY=FR" ,
dtstart=parse("2012-06-15"))
for date in rule:
print date

../rrule.py
2012-06-15 00:00:00
2012-06-29 00:00:00
2012-07-13 00:00:00
2012-07-27 00:00:00
2012-08-10 00:00:00
2012-08-24 00:00:00
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] recurrence 0.1.0, Ruby library for recurring stuff EdvardM Ruby 3 09-10-2008 08:20 PM
[ANN] recurrence 0.1.0 Edvard Majakari Ruby 0 09-03-2008 08:55 PM
Code that will returns dates from a recurrence rule? Dwight Schrute Ruby 0 01-26-2006 09:12 PM
Thunderbird News : auto expand threads Rizzo Firefox 1 03-02-2005 07:45 AM
How to solve recurrence relation? Johnathan Dole Java 3 04-19-2004 02:32 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57