I'm looking for how to get number of months and remaining days between 2 dates.
Example: in = 2017-04-10, out = 2017-05-15
output should be 1 month, 5 days
-
this is what i tried: number of months
var numofmonths = out_month - in_month + (12 * (out_year - in_year));
if(out_day < in_day){
numofmonths--;
}
and days
var numofdays (end - start) / (1000 * 60 * 60 * 24)
output is like 1 month, 35 days.
how can I remove the days of the month if there is month, and show only remaining days?