Let's assume I have two dates in variables, like :
$dateFrom = '2021/07/20';
$dateTo = '2021/08/10';
I did that but it still doesn't get results:
$from = new \DateTime($dateFrom);
$to = new \DateTime($dateTo);
$interval = $to->diff($from);
$a = $interval->format('%m months');
dd($a); // result : 0 months
I need to calculate the number of months between $dateFrom and $dateTo. I need to get 2.
Is there any way to get it?
Thanks
update: Mine is less than 60 days, less than 2 months. But how to complete 2 months
 
     
    