This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to find differance between two dates excluding weekends

 
Jaideep Kshirsagar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Excluding Saturday and Sunday, I want to calculate remaining days difference (count) in two given date objects. Please hit back ASAP.
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just an initial thought here.

First get the difference in dates including weekends:

Then subtract the number of weekends between them.
 
Adam Schaible
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to have a look at Joda Time, I believe some variation will be included with Java 1.7, and it makes for easy time/date calculations. I don't believe it will remove the weekends for you, but could make it a bit easier.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic