Possible Duplicate:
What is the best way to represent “Recurring Events” in database?
I'm planning an event calendar feature for my site, and want to allow users to enter recurring events by any combination of recurrence patterns (i.e. first Tues of every n months, every Tues/Wed each week, 13th every n months, etc...)
After trying to plan out the logic, my brain is starting to melt. How do you build an event in which it can follow nearly any combination of recurrence patterns? How do you query for an event on a specified day (assuming there are events, through some combination of it's recurrence pattern)?
I don't care about changing specific instances of a recurring event.