Age is displayed on a contact record but only DOB is a token available in message templates.

Are there any extensions that make age available for use? I've not been able to locate anything.

2 Answers 2


This sounded like a useful feature, so I added Age tokens to Eileen's CiviTokens extension, which seems to be the most widely used extension of its kind. Until a new release comes out, you'll have to pull from the master branch of the git repo.

  • Amazing. Thank you. Pulling shortly. Dec 22, 2019 at 15:38

I don't see any either, but the code to use in such an extension (as either a token or even a smarty modifier) seems pretty straightforward:


      if ($contact->birth_date) {
        $birthDate = CRM_Utils_Date::customFormat($contact->birth_date, '%Y%m%d');
        if ($birthDate < date('Ymd')) {
          $age = CRM_Utils_Date::calculateAge($birthDate);
          $values['age']['y'] = CRM_Utils_Array::value('years', $age);
          $values['age']['m'] = CRM_Utils_Array::value('months', $age);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.