How can I get the number of business days between two java.util.Date, i.e. excluding weekends and holidays? By holidays, I mean legally recognized holidays. It
This seems to be a common problem with Date calculations. I often shudder at suggesting to use JodaTime, but it seems to be the de facto Date API for Java. If you want to be adventurous it is trivial to implement a class that has dates based on the year. So we know that in America town that the 4th of July abides by these rules
"Federal law (5 U.S.C. 6103) establishes the following public holidays for Federal employees. Please note that most Federal employees work on a Monday through Friday schedule. For these employees, when a holiday falls on a nonworkday -- Saturday or Sunday -- the holiday usually is observed on Monday (if the holiday falls on Sunday) or Friday (if the holiday falls on Saturday)."
So given this knowledge you could calculate what day of the week a holiday would occur and subtract that value from the number of days between two ranges.