This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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.
I agree. Here's the link:
subject: Holiday in date
It's not a secret anymore!