I am trying to create 2 events that have custom repeats but I can't quite figure out the coding.

  1. I need an event that happens every 30 days but if the 30th day is a weekend I'd like it to move to the following Monday. But I also need it to stay on the original 30 day cycle.

  2. I also need an event that happens x week days before x day of the month. For instance I'd like an event that happens 3 weekdays before the 15th of every month.

Any help would be great.

  • My personal advice would be to avoid complicated RRULE's since not all ical applications handle them properly. I'd suggest writing a short computer program or something similar.
    – user5676
    Mar 8, 2016 at 15:04
  • That could be an option if I could write a program. But that puts several limitations on how I need to use this particular calendar. I need to be able to share it with others and have it accessible. I don't have that much time available to learn how to program just to create a calendar. I appreciate the advise however. I May be able to create some sort of an auto hot key macro that would manually fill in a calendar for the next 20 years or something but again that seems like it would take way too much time if there is a way that the current standard can accomplish the same thing.
    – sevenomad
    Mar 9, 2016 at 5:49

2 Answers 2


To clarify, I meant write a program that creates an iCalendar, but lists dates explicitly instead of using an RRULE.

While there are several iCal creators online, I don't think any of them will handle the complexity of the rules you need, especially the first one.

You might find an RRULE for your second condition, but I found it easier to simply write a program.

Overall, although RRULE is a nice tool, it can't do everything. Sometimes, you just have to specify the dates yourself, which also gives you more flexibility to use other calendar formats which may not support RRULE.

I've now written:


and created these blank iCalendars per your date rules above.



Important notes:

  • Be sure to check my work: make sure the dates in the calendar are the dates you actually want.

  • For your first rule, I arbitrarily assumed the first event was on February 1st. You should tweak my program to generate the correct date (or contact me (see profile), and I can do this).

  • For your second rule, I created events from 2016 through 2037 inclusive.

  • To use these calendars, search/replace all instances of _SUMMARY_ with the actual summary of your event, all instances of _DESCRIPTION_ with the description, and so on. The calendars I created only have dates and randomly generated UIDs.

  • You should also change the PRODID of each calendar.

While I personally don't object, I'm not sure this question actually belongs on webapps, since its not about an existing web application.

  • "I'm not sure this question actually belongs on webapps..." I would tend to agree.
    – ale
    Mar 9, 2016 at 16:47
  • I wrote this answer in a Perl comment, and apostrophes confuse Emacs' Perl mode.... thanks for adding them for me! :)
    – user5676
    Mar 9, 2016 at 16:48

For the first one, can you give an example. For instance do you want it to move to the next month if needed ?

For the second one, I'd suggest the following given x=2


What the rule does is to say it can happen:

  • 3 days, 4 days or 5 days before the 15th (BYMONTHDAY=10,11,12)
    • 5 days in case the 3rd day before the 15th is a Sunday.
  • Also you say that your occurence rules is only on weekdays BYDAY=MO,TU,WE,TH,FR
  • out of the possible options in one month FREQ=MONTHLY;
  • it will take the later one BYSETPOS=-1


  • if the 13th is a Friday, the rule will return the 13th
  • if the 13th is a Saturday, the rule will return the 12th
  • if the 13th is a Sunday, the rule will return the 11th

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.