Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code to check whether a given date falls on weekend or holidays

 
Sonali Sabnis
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone provide a code fragment which will accept a date and check if it falls on weekend or holidays.
If it falls on weekend or holidays then I need to increment that date in order to check again if the new date( incremented) falls on holiday or weekend.

Appriciate yoor help and quick responses.
 
Campbell Ritchie
Sheriff
Posts: 48453
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Calendar classes will return day of week; I hope that's useful for a start.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As for holidays, you will need to specify what the holidays are. THese are different for each country, and will even be different each year (Easter and such).

If you have such a collection or array of holidays you can compare:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic