user354134
user354134

Reputation:

ical RRULE for "second week of January"?

What ical RRULE lets me choose the second (not necessarily full) week of January (for example)?

More specifically, the Sunday that starts the second week of January?

Usually, "1SU" would work, but if the month starts with Sunday itself, it would be "2SU", so I don't see an obvious solution here?

Upvotes: 0

Views: 285

Answers (1)

Auberon Vacher
Auberon Vacher

Reputation: 4775

If you want the Sunday that starts the second week in January, you have to say that that Sunday can be any month day except the first (and obviously, only can be below the 8th day of the month).

The way to do this is to specify a RRULE with FREQ=YEARLY;BYMONTH=1 to specify January, BYDAY=SU to specify Sundays, BYMONTHDAY=2,3,4,5,6,7,8 to specify that your Sunday cannot be the 1st of the month and that you are only interested in the one starting the 2nd week of the month.

To summarize:

RRULE:FREQ=YEARLY;BYMONTH=1;BYDAY=SU;BYMONTHDAY=2,3,4,5,6,7,8

Upvotes: 2

Related Questions