I have a script I use to calculate the age of users in my database
PHP Code:
<?
function calculate_age ($month, $day, $year) {
$ageTime = mktime(0, 0, 0, $month, $day, $year); // Get the person's birthday timestamp
$t = time(); // Store current time for consistency
$age = ($ageTime < 0) ? ( $t + ($ageTime * -1) ) : $t - $ageTime;
$year = 60 * 60 * 24 * 365;
$ageYears = $age / $year;
$actual=floor($ageYears);
return $actual;
}
?>
When I input something like 12-6-1989 it returns an age of 18 which is correct.
But when I was inputing an age of 12-16-1899 it returns an age of 38. Any idea why?