Question

Is there a public/government web service that I can call to find out what the national holidays are for a given year? (For the US and/or any country in the world.)

Edit: Does anybody have a set of formulas to calculate US holidays? (C# would be my language of choice if there is a choice.)

Was it helpful?

Solution

There's a web service at http://www.holidaywebservice.com which will provide dates of holidays for the USA, Republic of Ireland, England and Scotland. They also sell a DLL and source code.

As for details of algorithms, you could do worse than check out the excellent Calendrical Calculations book (third edition), which is a really fascinating read for all matters calendrical, and includes sample LISP code for their calendar algorithms.

OTHER TIPS

You can try http://kayaposoft.com/enrico/. Enrico Service is a free service providing public holidays for several countries including US. Public holidays for the countries like US or Germany are provided separately for each state. You can use either web service or json to get public holidays from Enrico.

There are online calendars you can subscribe to. For example, Google provides US Holidays:

ICAL HTML

No one gives that up for free (any country in the world? Get real). The best source is Copp Clark (I'm unaffiliated). They provide all holidays for all countries broken down by financial market, currency, etc.

There are tons of similar information that really should be provided by government web services. It would certainly save a lot of money and errors in the long run if the U.S. Government could provide information like this through web services. Heck, even having it in a downloadable, parseable format would be a big step in the right direction.

I ran across this question while looking for a way to ensure an application skipped all U.S. Federal holidays in working days calculations. The best .gov source I found is:

Operating Status Schedules from OPM

This has the data we need through 2020, but we'll have to type it into our own tables.

Some parsing may be required, and it's not 100% complete, but you can use wikipedia.

For the method/assembly to figure out US Holidays, basically just figure out all the major holidays and the "formula" that they use.

For the ones that never change, like Christmas, it's easy - December 25th.

For the ones that do change somewhat, there's usually a formula - like the third Monday in February being Presidents Day. You can just have the method figure this out for a given year.

This won't work for holidays without any particular pattern (i.e., some committee decides what the date is every year) but for all the major ones there's easily discernible formulas.

This would actually be a great candidate for Test Driven Design. You will know all of the major holiday dates for a particular year, so you should be able to feed that year into the method and get the right answers.

I am looking for something similar PL/SQL based. I found jollyday (sourceforge). It is java maybe you can use it with ikvm from c#. Sadly I was not able to load the java api into my oracle rdbms ... so ... if you came across a pure C or PL/SQL solution, please let me know :-)

Cheers Chris

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top