This problem has long been dead, but I was looking for an answer; something simple that will handle all the most common approaches. In particular, how to save these dates in a relational database.
I am considering, but have not implemented the following solution:
Table: Schedule
Id
Name
Startdate
Endate
DayOfYear (there can be any sequence of numbers from 1-365)
DayOfMonth (can be any sequence of numbers from 1-31)
Month (any sequence 1-12)
DayOfWeek (Any sequence of 1-7)
WeekOfMonth (any sequence of 1-5)
SkipInterval (smallint)
Exclude (Many2Many relation to this table)
Examples:
Where are all the other meanings: Nil.
Labor Day: StartDate = 9/1/2013, DayOfWeek = 2 (Monday), month = 9, WeekOfMonth = 1
Valentine's Day: StartDate = 2/14/2013, DayOfMonth = 14, Month = 2
Every third Friday of every month: StartDate = 9/20/2013, DayOfWeek = 6, WeekOfMonth = 3
Any other Friday: StartDate = 10/4/2013; DayOfWeek = 6, SkipInterval = 2
Every day of the week: StartDate = 10/4/2013; DayOfWeek = 2-6
Every day: StartDate = 10/4/2013
Every Monday: StartDate = 10/7/2013, DayOfWeek = 2
Exceptions can be used to remove all holidays from the event schedule. (Nobody is going to work for Thanksgiving, right?), Assuming all the Holidays are introduced.