HOME © 2008 Michael Thompson

Algorithm for Calculating
Floating Holidays

[ Main Index ]

[ Easter Holiday Algorithm ]        

Sample Implementation:

Purpose:

Method:

  1. Set the following values corresponding to the holiday's target day of the week (0=Sunday, 1=Monday, etc.), the month (Jan=1) and the desired year:
  2. Determine from the definition of the holiday the earliest possible date in the month on which it could occur:

  3. Determine the weekday of the earliest possible date in the month on which the holiday could occur in the given year. Since this is language-specific, here are a few examples:

  4. Find the offset between the target weekday and weekday of the earliest possible date in the given year:

  5. Calculate the actual date of the holiday using the earliest possible date and the offset for the given year:

Memorial Day

Election Day