Query regarding calculate months but with some conditions. with Joda Date-time or date util.
Start Date : 01/01/2018
End Date : 31/12/2020
Total Period difference between above date: 36 months and 0 days
so total month =36
Start Date : 01/01/2018
End Date : 02/01/2021
Total Period difference between above date: 36 months and 2 days
.
if there are days remaining then it consider single month.
so total month 36+1= 37
Date issueDate1=03/06/2017;
Date dateTo1=02/06/2020;
int investmentPeriod = Months.monthsBetween(issueDate1, dateTo1).getMonths();
By joda above months are coming 35
which is wrong.
Date start=23/06/2017;
Date end=06/07/2017;
here difference less than a month . so it consider as single month.