How to get all dates between two dates in Android.
For example. I have two Strings.
String first="2012-07-15";
String second="2012-07-21";
I convert and get dates from these strings.
DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
DateFormat df2 = new SimpleDateFormat("MMM dd");
String mydate = df2.format(df1.parse(first));
This way I get both dates from first and second String.
Now I also display all dates between these two dates.
it is better not to use any hardcoded values in date calculations. we can rely on java
Calendar
class methods to do this tasksee the code
and use it as below