Java's GregorianCalendar class knows nothing about holidays, since thay are particular to a location, and subject to change. What you could do is create a static data structure containing all the dates which constitute a holiday in whichever location your application is being run (you will have to populate this manually) and check dates against it. For example you could have a HashMap for each year, keyed on Calendar.DAY_OF_YEAR, whose value is a Boolean denoting whether it is a holiday or not.
Originally posted by Biswajit Paria: In other ways, by creating a table in database with holidays list we can do the same thing.
Yes, but for speed you probably want this in memory. A database round trip every time you use a date is a bit of an overhead. If your application reads your table once when it starts up and hold the data in memory you avoid this.
Joined: Sep 16, 2005
Originally posted by Biswajit Paria: Jeff Albertson , How do you want to feel..?
Yaar, I want to feel that Java will be able to tell me when Diwali starts.