Data structure for storing recurring events?

Viewed 12399

I'm looking for a data structure pattern for storing recurring events, but everything I came up with would result in a high number of special case handling or user input and data retrieval are overly complex. (I get the distinct feeling, that I haven't understand the problem domain well enough to do this.)

How can I store Outlook-style recurring events?

  • Every day at 8am
  • Every first tuesday in a month
  • Every December 1st for three years
  • Every two hours for a week
  • ...
4 Answers

Support the standard iCalendar Event types

The IETF put some thought into this when they created the Internet Calendaring and Scheduling Core Object Specification, better known as iCalendar.

The specification includes event recurrence.

As an added bonus, your database will be amenable to sharing data with other iCalendar compatible data sources such as Google and Apple calendars.

https://www.rfc-editor.org/rfc/rfc5545

Related