SCJP 5.0, Preparing for SCWCD
SCJP 5.0, Preparing for SCWCD
Campbell Ritchie wrote:Joda Time it is, then. But why can you not upgrade?
SCJP 5.0, Preparing for SCWCD
Martin Vajsar wrote:There are slight differences between JodaTime and the new Java 8 API. Each one is better in some aspects and worse in others, sadly.
However, neither of them, as far as I know, has a built in support for handling public holidays and working/nonworking days. Uncle Google might help: java business calendar. Some libraries did pop up in the search, but I didn't have a closer look.
In one of our projects, I've implemented a business calendar myself, but I only needed things like nextBusinessDay(), prevBusinessDay() and isBusinessDay(), which are relatively straightforward. Doing more complicated operations could use some external library.
SCJP 5.0, Preparing for SCWCD
Martin Vajsar wrote:There are slight differences between JodaTime and the new Java 8 API. Each one is better in some aspects and worse in others, sadly.
However, neither of them, as far as I know, has a built in support for handling public holidays and working/nonworking days. Uncle Google might help: java business calendar. Some libraries did pop up in the search, but I didn't have a closer look.
In one of our projects, I've implemented a business calendar myself, but I only needed things like nextBusinessDay(), prevBusinessDay() and isBusinessDay(), which are relatively straightforward. Doing more complicated operations could use some external library.
SCJP 5.0, Preparing for SCWCD
Martin Vajsar wrote:Sorry for the late reply.
There isn't anything special about isBusinessDay. It might be just a list of all exact holiday dates covering the period you're processing, or it might contain rules to generate holidays based on their definitions. Holidays may be fixed (they fall on given day of month every year), in which case I keep the day, month, first year of observance and last year of observance, or they may be moving. In my country, Easter Monday is the only moving holiday. I'm using the Computus algorithm to find the occurrence of Easter in a given year.
SCJP 5.0, Preparing for SCWCD