aspose file tools*
The moose likes Beginning Java and the fly likes Calculating no. of working days between tow dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calculating no. of working days between tow dates" Watch "Calculating no. of working days between tow dates" New topic
Author

Calculating no. of working days between tow dates

Chinmay Ogale
Greenhorn

Joined: Dec 24, 2003
Posts: 4
Can anybody help me in this issue?
If two dates are given then how can the no. of working days(excluding Sat. and Sun.) be calculated in Java. Anyn readymade methods available.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
You want it served to you on a platter?

What have you tried since last asking this question?

http://forum.java.sun.com/thread.jsp?thread=555074&forum=31&message=2719384
Chinmay Ogale
Greenhorn

Joined: Dec 24, 2003
Posts: 4
Hi Michael,

I tried the code below-->public class WeekdayTest extends TestAbstract {

But in this case the while Loop goes into infinite loop. not getting exactly how to loop on 2 dates??

[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ September 20, 2004: Message edited by: Dirk Schreckmann ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'd take a look at the line:

Given how you've written this, how do you expect start or end to change?

I'd consider using Calendar objects instead of Date objects too. If you have a look at the methods avaliable to a Calendar object you'll see why.
[ September 20, 2004: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Hopefully the corrections are self-explanatory

Chinmay Ogale
Greenhorn

Joined: Dec 24, 2003
Posts: 4
Hi Michael,

Thanks for the solutions. It worked. I was not aware of calendar class. This relaly helped in learnign date related manipulations using java. Hope that u will help me in future also. Thanks once again.

Regards
Chinmay
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating no. of working days between tow dates