calculate the date difference between two dates exclude the saturday and sunday

Reply

Join Date: Dec 2007
Posts: 9
Reputation: palcham is an unknown quantity at this point 
Solved Threads: 0
palcham palcham is offline Offline
Newbie Poster

calculate the date difference between two dates exclude the saturday and sunday

 
0
  #1
Dec 11th, 2007
calculate the date difference between two dates exclude the saturday and sunday(Please dont calculate saturday and sunday between two dates)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #2
Dec 11th, 2007
Hang on... Are you telling us to do it for you? The whole *point* of this fourm is to *HELP* out with problems not do your work for you!
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 9
Reputation: palcham is an unknown quantity at this point 
Solved Threads: 0
palcham palcham is offline Offline
Newbie Poster

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #3
Dec 11th, 2007
Ok ok Sorry is there any code for calculate the date difference between two dates with out calculating the saturday and sunday.is there any code means please send to me.

Advance Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,355
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #4
Dec 11th, 2007
A Loop, counter, an if statement, a Calendar and its add(int, int) and get(int) methods, and its day of the week named constants.

Read the API docs for Calendar, then try to whip something up based on the above, and if it doesn't work, post it, and we'll help you to correct it.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 9
Reputation: palcham is an unknown quantity at this point 
Solved Threads: 0
palcham palcham is offline Offline
Newbie Poster

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #5
Dec 13th, 2007
Hi
I applied but i can't get the answer please can you send example program codes
Please help me

Advance Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,355
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #6
Dec 13th, 2007
Well, lets see what you have.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,355
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #7
Dec 13th, 2007
pseudo code
  1. counter
  2. current date = start date // current date is a Calendar object however
  3. while (current date less than end date)
  4. increment counter
  5. add one to current date

Forgot to mention that you will also need compareTo from the Date class (and the if is not needed when done this way).
Last edited by masijade; Dec 13th, 2007 at 6:01 am. Reason: typo and a little further info
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 9
Reputation: palcham is an unknown quantity at this point 
Solved Threads: 0
palcham palcham is offline Offline
Newbie Poster

Re: calculate the date difference between two dates without saturday and sunday

 
0
  #8
Dec 13th, 2007
Hi dont mistaken me,i know the logic but some problem occur so you please send to the example code
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

Re: calculate the date difference between two dates exclude the saturday and sunday

 
0
  #9
Dec 13th, 2007
why don't you post your code here?
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,355
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is online now Online
Nearly a Posting Maven

Re: calculate the date difference between two dates without saturday and sunday

 
0
  #10
Dec 13th, 2007
Originally Posted by palcham View Post
Hi dont mistaken me,i know the logic but some problem occur so you please send to the example code
Well, like I said

Originally Posted by masijade View Post
Well, lets see what you have.

I am not simply going to post the code here, without you having proven that you have already tried it. From What I see here, you are simply trying to get someone else to do this for you.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC