php get age from dob
snippet in php

php get age from dob

user5091

Simple method for calculating Age from dob: $_age = floor((time() - strtotime('1986-09-16')) / 31556926); 31556926 is the number of seconds in a year.

age php datetime

user1922

function get_age( $date ) { 
    $age = date('Y') - $date; 
   if (date('md') < date('md', strtotime($date))) { 
       return $age - 1; 
   } 
   return $age; 
}