Return to Snippet

Revision: 61618
at December 28, 2012 22:01 by gummiost


Initial Code
function get_age($birthday)
{
    $birth = strtotime($birthday);
    $now = strtotime('now');

    $age =  ($now - $birth) / 31536000;

    echo floor($age);
}

get_age('15 march 1984');

Initial URL

                                

Initial Description
This function will get the age in years. It compares the inserted date with the current date and outputs the result.

Initial Title
Get age in years

Initial Tags

                                

Initial Language
PHP