Is there a mechanism or a method in Joda Time itself/or some other API through which i can achieve the same.??? Please suggest?
Input Date: 2018-04-30
Used Joda Time like this gives output: 2018-05-30
Expected Date : 2018-05-31
Edited Again Want to know if it will be alright to say and do like this meaning
if the input date is the last date(will use the algos shared) then fetch the last date of the next month and
else if input date is anything else then use plusMonths method
String startDate = "2018-04-30"; DateTime startDateTime = new DateTime(startDate, DateTimeZone.UTC); int repeatEvery = 1; int numOfPayments = 2; String endDate = startDateTime.plusMonths(repeatEvery * (numOfPayments-1)).toString(); System.out.println(endDate);