wood burning stoves 2.0*
The moose likes Java in General and the fly likes how to find differance between two dates excluding weekends Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to find differance between two dates excluding weekends" Watch "how to find differance between two dates excluding weekends" New topic
Author

how to find differance between two dates excluding weekends

Jaideep Kshirsagar
Greenhorn

Joined: Aug 29, 2007
Posts: 27
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

Joined: Oct 27, 2005
Posts: 19693
    
  20

Just an initial thought here.

First get the difference in dates including weekends:

Then subtract the number of weekends between them.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Adam Schaible
Ranch Hand

Joined: Oct 04, 2007
Posts: 101
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to find differance between two dates excluding weekends