View Single Post
08-12-2008, 07:45 PM
#1
Jako is offline Jako
Jako's Avatar
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
 
Posts: 2,199
iTrader: 3 / 100%
 

Jako is on a distinguished road

  Old  Age Calculation Script

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(000$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?