Return to Snippet

Revision: 51016
at September 12, 2011 20:13 by stefpretty


Initial Code
function age_from_dob($dob) {
    return floor((time() - strtotime($dob)) / 31556926);
}


function getAge( $p_strDate ) {
    list($Y,$m,$d)    = explode("-",$p_strDate);
    return( date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y );
}

Initial URL


Initial Description
A couple of ideas and options...

Initial Title
Calculate age from DOB

Initial Tags
php, function

Initial Language
PHP