Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Holidays - is there a java implementation?

Tags:

java

date

I'd like to know if there is a jar-file out there that could do the following:

DateMidnight dateInQuestion = new DateMidnight(12,12,2000); DateChecker.isNationalHoliday(dateInQuestion, Locale.ITALY); 

If there isn't, why? Surely there are lots of properly based rules for the holidays in 99% of the times.

Right now we're mainting a table in our database, with the countries + we have some implementation when it comes to holidays that aren't on the same date every year. We have to add to our implementation for every new country we get new customers.

Could we do this an easier way?

(If there is no such thing in the java sphere, can I port it from some other language?)

like image 646
Espen Schulstad Avatar asked Aug 02 '10 14:08

Espen Schulstad


2 Answers

I have written the Jollyday API and I'm interested to know what is so 'rough' about it. How can I improve it? Would be great to hear from you. Send me an email to [email protected] if you like.

By the way. Jollyday is used just the way as the questioner requests it. Please look for yourself.

Cheers, Sven

P.S.: I found a free webservice from Ulrich Hilger which provides detailed worldwide holiday info. Look at api.daybase.eu

like image 125
Sven Avatar answered Oct 10 '22 13:10

Sven


Nothing robust exist in Java as far as I know. It also makes sense, this kind of information is namely extremely sensitive to changes. Hardcoding it would make your code potentially break on every Java update which may lead to lot of maintenance and compatibility troubles. Currently at hightest the timezones are hardcoded/maintained in Java SE and even alone that has already lead to many bugs.

Rather use a public webservice for that. E.g. http://www.bank-holidays.com

This site informs you of all the days when banks (as well as stock exchange & school holidays in a number of countries) are closed due to religious or public events. Major events (elections, announced strikes, trade fairs, festivals, sports events...) are also listed.

Our FREE SERVICE allows you to view the current calendar year (view only). For 2 euros/country/year, our PAY SERVICE (click on credit card icon) gives you access to calendar years 2000-2070.

And write a Java wrapper around that. Or look for existing Java API's which are in turn already backed by a webservice.

like image 39
BalusC Avatar answered Oct 10 '22 15:10

BalusC