This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Holiday in date" Watch "Holiday in date" New topic
Author

Holiday in date

Kristol Crawley
Greenhorn

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
Sheriff

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
Greenhorn

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.
 
jQuery in Action, 2nd edition
 
subject: Holiday in date
 
Similar Threads
java.util.Date for any year
display only 2 rows from a recordset size of 10
WA #1.....word association
How to check a date as 'holiday' in java
how to change color of a date in calendar