📅  最后修改于: 2022-03-11 14:54:51.884000             🧑  作者: Mango
public function getAge($date)
{
$dob = new DateTime($date);
$now = new DateTime();
$difference = $now->diff($dob);
$age = $difference->y;
return $age;
}