I'm currently using the diff command in php to make a difference of two months, but that difference comes out but it's wrong it's not the correct one:
Date today: 8-03-18
future date: 07-05-18
This is the result that I get:
The middle box is the one that is supposed to pretend as a counter in reverse between both dates, but instead of saying 10 months it should say 1 month and 29 days.
Code
<?php
$hoy = date('j-m-y');
$despues='07-05-18';
$horafutura='00:00';
$d1 = new DateTime($hoy);
$d2 = new DateTime($despues);
$interval = $d2->diff($d1);
echo '<div class="horario">'.$interval->format('%y years %m months %d days').'</div>';
?>