I am trying to calculate the remaining months and days before a payment is due.
So if the last payment was received >= 2013-08-01 then I want to add 24 months from the last payment and then show how many months and days remaining before the next payment is due.
Here is what I have tried but the output is not correct:
$lastOB = new DateTime('2013-10-15');
$ny_min = new DateTime('2013-08-01');
$now = new DateTime('now');
if($lastOB > $ny_min){
$due_date = $lastOB->add(new DateInterval('P24M'));
$duedate_interval = $now->diff($due_date);
//echo $duedate_interval->days;
echo $duedate_interval->format('%m month, %d days');
} else {
echo 'due now';
}
The current output is 2 months, 7 days.
The output should be the remaining of (2013-10-15 + 24 MONTHS) - TODAY's date.