public static function getAge($record) { $createdOn = $record->created_on; $currentDate = new DateTime(); return $currentDate->diff($createdOn); }