Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to find differance between two dates excluding weekends  RSS feed

 
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
Posts: 21047
85
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
Boost this thread!