Recurrence rules and time zones
A repeating event is stored as a rule, a start in a named time zone and exceptions keyed by the occurrence they replace; occurrences are computed per viewed window and converted to the viewer's zone when drawn.
What it is
A recurrence rule describes a repeating event without listing its occurrences. In the iCalendar format (RFC 5545) the rule is an RRULE with a required frequency (SECONDLY up to YEARLY), an optional INTERVAL (2 for alternate weeks), and filters such as BYDAY, BYMONTHDAY and BYSETPOS (the last Friday of the month). A rule ends with UNTIL (an inclusive date) or COUNT (a number of occurrences), and the two can't be combined. With neither, the rule has no end. The event's own start (DTSTART) is the first occurrence and counts toward COUNT. Generated dates that don't exist, such as February 30, are dropped rather than moved.
# The series: Thursdays at 9:00 New York time, 30 minutes, no end,
# with Thanksgiving skipped.
UID:standup-42
DTSTART;TZID=America/New_York:20260903T090000
DURATION:PT30M
RRULE:FREQ=WEEKLY;BYDAY=TH
EXDATE;TZID=America/New_York:20261126T090000
# One occurrence moved to Friday afternoon. Same UID; the
# RECURRENCE-ID is the start it would have had, not the new one.
UID:standup-42
RECURRENCE-ID;TZID=America/New_York:20261008T090000
DTSTART;TZID=America/New_York:20261009T140000
DURATION:PT30MThe recurrence set and its exceptions. The full set of occurrences is built from DTSTART and the RRULE, plus any extra dates listed in RDATE, minus the dates listed in EXDATE; an exclusion wins over anything the rule generates. A changed occurrence is a separate component that shares the series UID and carries a RECURRENCE-ID equal to the original start of the occurrence it replaces. That key stays the same when the occurrence is dragged to another day: a Friday meeting moved to Thursday is still identified by the Friday. A RANGE=THISANDFUTURE parameter on the key extends one change to all later occurrences, shifting each by the same difference, but Outlook (2007 through the new Outlook for Windows) drops that parameter on export and ignores it on import. Our advice: don't depend on it, and implement "this and following" by splitting the series.
Where the time zone lives. The same RFC recommends giving a recurring DTSTART as a local time with a time zone reference (TZID=America/New_York), so all occurrences keep the same wall-clock time when the zone moves its clocks. The zone changes the arithmetic in other places too: UNTIL has to be given in UTC when the start carries a zone; DTEND fixes an exact length for all occurrences while DURATION fixes a nominal one, so a one-day nominal duration is more or less than 24 hours on a day the clocks change; and an occurrence whose local time doesn't exist on a spring-forward day (1:30 AM where clocks jump from 1:00 to 2:00) is, by the rule's definition, left out of the set.
Why a UTC instant is the wrong primary copy for a future event. Zone rules are data, and that data changes: the IANA tz database's announcement list shows six releases in 2026 alone, from 2026a in March to 2026f in late October, among them Cuba staying on its summer offset instead of falling back on 2026-11-01 and Manitoba moving to a permanent -05 offset. Jon Skeet's argument against "just store UTC" rests on this: a conference entered as 9 AM on a date in Amsterdam is a fact about local time, and if the zone's rules change before that date, a stored UTC value now points at the wrong moment, and recovering the intended local time needs the old rules version. His preferred design keeps the local time and zone id as the record of what the organizer entered and treats the UTC instant as a derived field, recomputed after a tz update, kept for sorting and countdowns.
| API | The series | One occurrence | A changed or removed occurrence |
|---|---|---|---|
Google Calendar API v3 | An event with recurrence data; | Carries | Update the instance by its id; its |
Microsoft Graph v1.0 | An event of type | Type | Type |
When to use it
Reach for a rule plus overrides whenever a user can say "repeat" without naming an end, or when the series must be editable as a whole (change the time of all stand-ups in one write). Store what was entered: local start, zone id, duration, the rule, the excluded starts and the overrides. On a read, expand just the requested window: the week view asks for seven days, so generate occurrences from the first candidate whose end could fall inside the window (start the walk one duration before the window opens, so a meeting that begins late Sunday and runs past midnight is still drawn) and stop at the window end; an open-ended rule is harmless because nothing walks it to the end. Convert each occurrence to the viewer's zone at the last step, when positioning it on the grid.
Materialize when reads cut across many series. A free-busy lookup over thirty attendees, a reminder that has to fire at 8:55, or a search for "meetings next quarter" would otherwise expand each series on each query. Our advice: keep the rule as the source of truth and write occurrence rows for a rolling horizon (a year ahead, say), extended by a scheduled job and rebuilt for one series when its rule changes. The occurrence table gets an index on start time and owner; the rule row stays small. See Job scheduling and delayed work for the horizon job and Database indexes for the range query.
When not to
A one-off meeting needs no rule: a start, an end and a zone id are enough. Something that already happened (a log line, a payment) is an instant, and a UTC timestamp is the right copy because no future rule change can move the past. A machine schedule that means elapsed time (a run each six hours) belongs in UTC too; anchored to a wall clock, the gap between two runs can stretch to seven hours or shrink to five on the day the clocks change. And a fixed, short series (a six-session course) can be six plain rows; an edit to "all six" touches six rows, which is fine, and each session can have its own room without an override mechanism.
Don't take on the whole RRULE grammar on day one. Second- and minute-level frequencies, BYSETPOS combined with BYWEEKNO, and week-start rules exist in the format, but a calendar product can offer daily, weekly, monthly and yearly with an interval, chosen weekdays and an end, and still accept the rest on import without offering to edit them. Nor should a client store expanded occurrences as if they were events: a week view that caches seven occurrences of a stand-up and then receives a series edit has to know to throw them all away, so cache the series and the overrides and expand locally.
Compared
| Option | What it stores | Weak point | When it's the right choice |
|---|---|---|---|
Rule, expanded on read | One row per series plus overrides | Queries across many calendars expand each series each time | Single-calendar views, few series, edits more common than searches |
Rule plus a materialized horizon | Series row and occurrence rows for the next N months | A rule edit rewrites rows; a job must extend the horizon | Free-busy, reminders and search over many series |
One row per occurrence, no rule | N independent events | No open-ended series; a series edit touches all rows | A short fixed count where each session differs anyway |
UTC instant as the primary copy | Milliseconds since the epoch | Future local times drift when zone rules change; occurrences shift an hour across clock changes | Past timestamps and machine schedules measured in elapsed time |
Local time plus zone id |
| Needs a current tz database at read time; UTC must be derived | Future events people attend |
In a picture
How to say it in an interview
The common mistake
Quiz
Questions that use this
Related
- Job scheduling and delayed work
- Clocks and ordering
- Core entities and the data model
- Database indexes
- Laying out overlapping events in a time grid
- Sorting and formatting for the reader's language
Sources
- RFC 5545 section 3.8.5.3: Recurrence Rule (icalendar.org)
- RFC 5545 section 3.3.10: Recurrence Rule value type (icalendar.org)
- RFC 5545 section 3.8.4.4: Recurrence ID (icalendar.org)
- RFC 5545 section 3.8.5.1: Exception Date-Times (icalendar.org)
- RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar)
- [MS-STANOICAL]: RFC 5545 Section 3.8.4.4 Recurrence ID, Outlook behavior
- Google Calendar API: Recurring events
- Google Calendar API v3 reference: Events: instances
- Google Calendar API v3 reference: Events resource
- Microsoft Graph v1.0: event resource type
- Jon Skeet: Storing UTC is not a silver bullet
- IANA tz-announce mailing list: tz code and data release announcements