You haven't given us any information on the table that you are trying to query to get the results you want. You would probably use BETWEEN in your SQL, maybe a GROUP BY but you will have to give us some more information.
I love this place!
Joined: Jun 09, 2010
no tables, just if we give two dates, i need list of dates.
Ramasubramaniam Rathinasubbu wrote:no tables, just if we give two dates, i need list of dates.
You will probably get much better answers and certainly more attention to your posts if you post them in the right forum. Here's a link to a forum where you can ask general JAVA questions.
Anyway, it is not at all clear from your post what you are looking for, but just in case I understood what you after here's my proposal for a solution:
// First create 3 instances of a Calendar date, one to hold you start date, one to hold your end date and one to hold tha dates in between as they are generated inside the loop
Calendar startDate = Calendar.getInstance();
Calendar endDate = Calendar.getInstance();
Calendar currDate = Calendar.getInstance();
// Next set each object to the desired date. The startDate and currDate will be set to the same value
startDate.set(2011, 5, 1);
endDate.set(2011, 5, 7);
currDate.set(2011, 5, 1);
// Now create the loop that will generate the desired list of dates
while (currDate.equals(endDate) == false)
You will probably want a DateFormat class to make your date appear human readable.