I\'m trying to convert the difference between two dates into a total year count, right now I\'m using this:
$datetime1 = new DateTime(\'2009-10-11\');
$da
If you don't care about perfect accuracy:
return $interval->days / 365;
You could also do something like return $interval->y + $interval->m / 12 + $interval->d / 365
.
Didn't even notice your weird decimal convention until I saw @2unco's comment. That would look like: return $interval->y . '.' . $interval->m
.