Hi all,
Is it possible in java to get all dates between two dates
for example
date1-> '01-11-2010'
date2-> '05-11-2010'
date3-> '10-11-2010'
Result :
'02-11-2010','03-11-2010','04-11-2010','06-11-2010','07-11-2010','08-11-2010','09-11-2010'
Can any one help me please..
You can take the input- Start date and end date. So from Start date onwards- Keep adding 1 day to the date till the date is less than your end date. You can use- the add() method in the Calendar class.
thanks for your reply
I tried using list and am getting the missing dates..
But am not able to find the missing months..
example:
date1-> '11-11-2010'
date2->'02-01-2011'
I want to get all the dates between these two date
Nisha Kala wrote:I tried add function.. am not able to it..
I got dates as a list of String..
You have to be careful with the format of the dates. It will be easier if you have your startDate and endDate in java.util.Date and not in String. Otherwise you can use SimpleDateFormat and a correct pattern to convert them to Date instances. Once you have the Start and End dates in Date format. The next step would be: