File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Holiday in date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Holiday in date" Watch "Holiday in date" New topic

Holiday in date

Kristol Crawley

Joined: Sep 17, 2003
Posts: 7
Is it possible to tell if the date is a holiday? I looked through the api for calendar (we're on 1.3.1 btw) and I didn't see anything that looked like it would return that.
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
Java does not provide this functionality automatically. It will require some work on your part. Check out JavaWorld's Tips 'N Tricks Java Tip 44: Calculating holidays and their observances for some more info.
Kristol Crawley

Joined: Sep 17, 2003
Posts: 7
I figured it'd be messy!
Thank you Jason!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
here's one I was working on some time ago (I'm not from the US so I'm not entirely sure I have the parameters of the holidays correct)
easter calculation is close, but is incorrect (this is when I stopped), you might be able to add a tweak or two, to get it right.
subject: Holiday in date
jQuery in Action, 3rd edition