I want to calculate the number of months between two dates.
For example:
2022-10-19 - 2022-12-06 ~ 1,6 months
I tried this, but not every month is 30 days, so it is not a good solution:
$start = new DateTimeImmutable("2022-10-19");
$end = new DateTimeImmutable("2022-12-06");
$diffbetween = $start->diff($end);
$diffbetweenresult = round(($diffbetween->format('%a')) / 30, 2);
Can you help me?
Thank you very much!