Sunday, November 25, 2012

xataface calculate age

function beforeSave(&$record){
    $age=intval(substr(date('Ymd') - date('Ymd', strtotime($record->strval('Birthday'))), 0, -4));
    $record->setValue('Age',$age);
 }

Love the simplicity

No comments: