• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calculating weekday and weekend dates..Urgent  RSS feed

 
Victor Garcia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been trying to figure out how to calculate weekend and weekday rates for a project but no luck. So hopefully someone can offer a little assistance.. this is my scenario..

A user enters in the date that a furniture item is returned as a string.
the user also enters in the date it was due..
now supposed the furniture was due on 5/9/05 and returned on 5/18/05 i have 9 days the furniture is late. There is also different rates for weekends and weekdays. my problem is how do i first calculate the difference between the two dates.. then distinguish between weekend and weekday so that i could multiply those dates by the appropriate rates and produce a receipt...
Any help would be appreciated...Im stuck!!
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the java.util.Calendar class. There are methods which can tell you what day of the week a particular date is.

Henry
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must be one hell of a tycoon.
A furniture store owner in this thread

and video store owner here
[ May 07, 2005: Message edited by: Michael Dunn ]
 
Victor Garcia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the other thread i actually said video rental instead of furniture rental. I was thinking of two things at one time..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!