I have different dates in my program like 08-Mar-2017. How can I get next or previous date from this specified date?
Asked
Active
Viewed 1,042 times
1 Answers
2
Calendar cal = Calendar.getInstance();
cal.setDate(your date);
cal.add(Calendar.DAY_OF_MONTH, 1);
You have to convert the string into date and set it to calendar and then you can add a day and to remove
cal.add(Calendar.DAY_OF_MONTH, -1);

Arpan Sharma
- 2,142
- 11
- 22