my dog learned polymorphism*
The moose likes Java in General and the fly likes Hwo to get set of Dates between two limits ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Hwo to get set of Dates between two limits ?" Watch "Hwo to get set of Dates between two limits ?" New topic
Author

Hwo to get set of Dates between two limits ?

Muralidhar Gandepalli
Greenhorn

Joined: Apr 13, 2001
Posts: 13
Requirment :
If user Enters(mm/dd/yy) 01/01/03 and 01/05/03 i
need to get the following set as OutPut =
{01/01/03,01/02/03,01/03/03,01/04/03,01/05/03}
In order to achive above functionality ,Is there any Class in Java which has a function next() which returns me the next date ?
i.e XDate objXDate= new XDate(01/01/03);
objXDate.next()----> give me 01/02/03 .
If there is any class like this please let me know .That would be great help to me !!
thanx in advance
Murali
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

Look at the java.util.Calendar methods. These should work for you.

Of course, this code depends on whether you want a list of Date objects, how you want to handle startDate coming after endDate (users aren't always going to oblige), etc.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
sunita shaw
Ranch Hand

Joined: Apr 06, 2003
Posts: 45
thanx joel , u've got it exactally what i want but can u please write a small java/jsp program for this problem, i dunno where i'm making the mistake,cant send u my code coz its too long,so just send me as soon as possible.
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
how about you try yourself first and then tell us where the problems are instead of asking people to do your work ASAP....
it's early in the morning...too early for me....

k
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hwo to get set of Dates between two limits ?