<?php
$birthday = '1985-02-01';
$age = date('Y', time()) - date('Y', strtotime($birthday)) - 1;
if (date('m', time()) == date('m', strtotime($birthday))){
if (date('d', time()) > date('d', strtotime($birthday))){
$age++;
}
}elseif (date('m', time()) > date('m', strtotime($birthday))){
$age++;
}
echo $age;
?>
mysql 当前时间-n年计算
select date_add(curdate(), interval -1 year);
已抢186637个
抢已抢67304个
抢已抢353058个
抢已抢667283个
抢已抢122448个
抢已抢23811个
抢