Posted By

i0ni on 09/01/11


Tagged

get php with AGE calculate


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

catrinho
guillermoj88gmailcom
boksiora


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


 / Published in: PHP
 

  1. # mounth-day-year
  2. function getAge($date){
  3. $bday = explode("-", $date, 3);
  4. $bday = mktime(0,0,0,$bday[0],$bday[1],$bday[2]);
  5. $age = (int)((time()-$bday)/31556926 );
  6. return $age;
  7. }
  8.  
  9. #eg:
  10. echo getage("03-27-1990"); # returns the age.

Report this snippet  

You need to login to post a comment.