Using PHP DateInterval (available from 5.3.0), which is pretty easy:
$birthday = new DateTime('1990-10-13'); $diff = $birthday->diff(new DateTime()); $months = $diff->format('%m') + 12 * $diff->format('%y');
Now $months will contain the number of months in which I lived.
Daniel Egeberg
source share