I'm trying to replicate some scheduling functionality in Google Calendar in C# using the RFC5545 recurrence rule.
There are two options for scheduling monthly with Google calendar, either by every Nth day month, ie: Every 10th day of the month every 1 months, this will obviously occur regardless of the week day.
My recurrence rule for this is: FREQ=MONTHLY;BYMONTHDAY=10
The other option is to repeat the event on every Nth weekday, ie: "Every second Sunday every one months, this is the one I'm having trouble writing the rule for.
What should my rule be for the second rule? I've tried FREQ=MONTHLY;BYDAY=SU
, but I'm unsure how/which parameters to use to specify to only do this every 2nd Sunday of the month.
I'm using the DDay iCal C# library to generate my recurrence rule, but I'm happy to just be shown what the rule string should look like to achieve the desired behavior.
I'm using the RFC 5545 recurrence rule.
You are nearly there. What you need is to set the index for the day, RFC5545 says:
Each BYDAY value can also be preceded by a positive (+n) or negative (-n) integer. If present, this indicates the nth occurrence of a specific day within the MONTHLY or YEARLY "RRULE".
for which RFC5545 later gives an example
Monthly on the first Friday for 10 occurrences:
DTSTART;TZID=America/New_York:19970905T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR
so for you the rule has to be:
RRULE:FREQ=MONTHLY;BYDAY=2SU
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With