Första träffen på google gav:
[PHP]
<?php
// Calculate the age from a given birth date
// Example: GetAge("1986-06-18");
function GetAge($Birthdate)
{
// Explode the date into meaningful variables
list($BirthYear,$BirthMonth,$BirthDay) = explode("-", $Birthdate);
// Find the differences
$YearDiff = date("Y") - $BirthYear;
$MonthDiff = date("m") - $BirthMonth;
$DayDiff = date("d") - $BirthDay;
// If the birthday has not occured this year
if ($DayDiff < 0 || $MonthDiff < 0)
$YearDiff--;
return $YearDiff;
}
?>
[/PHP]
http://www.geekpedia.com/code79_Calculate-age-from-birth-date.html
Lycka till