This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calculating no. of working days between tow dates

 
Chinmay Ogale
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hopefully the corrections are self-explanatory

 
Chinmay Ogale
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic