Source Code:
(back to article)
<?php $date1 = new DateTime("2022-12-01"); $date2 = new DateTime("2023-01-01"); $interval = $date1->diff($date2); $months = ($interval->y * 12) + $interval->m; echo $months;
Result:
Report an issue