//************************************************************** //*  PHP Age Calculation Script  * //*  * //*  Written by: Eric Zander  * //*  15 January 2004  * //*  * //*  OK to copy and use however you want as long as you keep  * //*  this notice. I also appreciate email telling me that you * //*  find this script useful. * //* email me at eric underscore zander at yahoo dot com * //************************************************************** function Convert_DOB_to_Age($DOB) { //explode dates to arrays for easy processing. Format is yyyy-mm-dd $DOBArray = explode("-", $DOB); $TodayDay = date('d'); $TodayMonth = date('m'); $TodayYear = date('Y'); if (($TodayMonth > $DOBArray[1]) || (($TodayMonth == $DOBArray[1]) && ($TodayDay >= $DOBArray[2]))) {$Age = $TodayYear - $DOBArray[0];} else {$Age = $TodayYear - $DOBArray[0] - 1;} // return the age return $Age; }