Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 2204 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Age Calculation Script

Thread title: Age Calculation Script
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
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?

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed