Return to Snippet

Revision: 50754
at September 1, 2011 17:58 by i0ni


Initial Code
# mounth-day-year
function getAge($date){
$bday = explode("-", $date, 3);
$bday = mktime(0,0,0,$bday[0],$bday[1],$bday[2]);
$age = (int)((time()-$bday)/31556926 );
return $age;
}

#eg:
echo getage("03-27-1990"); # returns the age.

Initial URL

                                

Initial Description

                                

Initial Title
Calculate Age using PHP (mounth-day-year to age)

Initial Tags
php

Initial Language
PHP