how to calculate date difference excluding holiday

I would like to calculate the date difference, but I only want to focus on working day, I would like to exclude the Saturday and Sunday and some specific public holiday (these special holiday will be maintained in a static file), how to do that?
[252 byte] By [henry_22a] at [2007-11-27 5:51:56]
# 1

Well, the Calendar class will give you the day-of-week of the start and end dates, so you can work out the adjustment for the way weekends cut in. And you can calculate the raw number of days quite easilly by subtracting the milliseconds times and dividing by 24 * 60 * 60 * 1000. (round the result, because of possible problems with daylight saving time).

I'd probably do something like initially advancing the start date to the same day of week as the end date, working out the working days between, then subtract the adjusted start date from the end date, then divide by 7 and multiply by 5.

Then you just need to scan your holidays list for dates in the interval and subtract the hit count.

malcolmmca at 2007-7-12 15:41:52 > top of Java-index,Java Essentials,Java Programming...