Friday, August 9, 2013

Php Zend Birth Date To Age Calculate



$birthDate = $request->getParam('startdate');
            $birthDate = explode("-", $birthDate); 
              $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y")-$birthDate[2])-1):(date("Y")-$birthDate[2])); 

RESULT: 25



             

No comments:

Post a Comment