View Single Post
Old 08-14-2008, 12:47 PM   #4 (permalink)
buggabill
The Contributor
 
buggabill's Avatar
 
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
buggabill is on a distinguished road
Default

Quote:
Originally Posted by delayedinsanity View Post
You can still use mktime to get accurate ages.

PHP Code:
function getAge ($month$day$year)
{

    
$now mktime000date("n"), date("j"), date("Y") );
    
$then mktime000$month$day$year );

    
$age floor((((($now $then) / 60) / 60) / 24) / 365.25);

    return 
$age;


I stand partially corrected.

Take a look at the notes section for mktime.

Quote:
Caution

Before PHP 5.1.0, negative timestamps were not supported under any known version of Windows and some other systems as well. Therefore the range of valid years was limited to 1970 through 2038.
You need to be really careful if what you're writing has any chance of being used on systems like they describe.
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
buggabill is offline  
Reply With Quote