AnsweredAssumed Answered

How to Calculate Age from Date of Birth?

Question asked by Haroon Khaleeq on Oct 20, 2014
Latest reply on Oct 22, 2014 by Haroon Khaleeq
Hi Everyone,

                $GLOBALS['log']->fatal('Birthday is not empty');
                $date_of_birth = $bean->birthdate;                
                $date_of_birth = new DateTime($date_of_birth);                                
                $age = $date_of_birth->diff(new DateTime());                
                $GLOBALS['log']->fatal('Age: '.$age->y);                
                $bean->age_c = $age->y;                

There is an internal server error.
It is not letting parsing the date_of_field string to DateTime Object in sugarcrm 7.
Any suggestions ?