PHP Code:
////////////////////////////GET USERS AGE////////////////////////////////// function getage($birthdate)
{
list($day, $month, $year) = split('-', $birthdate);
$tmonth = date('n');
$tday = date('j');
$tyear = date('Y');
$years = $tyear - $year;
if ($tmonth <= $month)
{
if ($month == $tmonth)
{
if ($day > $tday)$years--;
}
else $years--;
}
return $years;
}
Code:
echo getage("30-05-1982");
No comments:
Post a Comment