I need the workingday-difference between two dates.
It is easy, to
- get the difference between two dates
- get the difference of weekdays between two dates
- get the workingday difference between two dates for a culture where you know the federal holidays.
But I'm wondering, if there is a method to get this difference in a generic way for any culture?
i.e. in the US, the 4th of july is a federal holiday. So - for Users from the US, the following calculation should apply:
//Assuming:
// 3rd July = Monday
// 4th July = Tuesday
// 5th July = Wednesday
workingDayDiff("03 July", "05 July", Locale.US) //2
workingDayDiff("03 July", "05 July", Locale.Germany) //3
While, around a german federal holidy, i.e. the 3th october:
//Assuming:
// 3rd Oct = Monday
// 4th Oct = Tuesday
// 5th Oct = Wednesday
workingDayDiff("03 Oct", "05 Oct", Locale.US) //3
workingDayDiff("03 Oct", "05 Oct", Locale.Germany) //2
If you know any libraries that work, I'm open for it. (I cannot lookup federal holidays for every possible country and store them somewhere...)
it wouldn't matter if start / Enddate is in- or exclusive, as this can be easily changed by using "+/- 1 day" on the dates.