1

How can I configure the token {domain.now} to use the short date format? Currently it uses the "Complete Date and Time" format.

The site is running 5.45.3. on Drupal 9

1 Answer 1

2

You could do something like this in the template:

{capture assign=notime}{domain.now}{/capture}{$notime|date_format:'%m/%d/%Y'}

Also there is this in recent versions but it may be iffy how well it works depending on the exact civi version:

{domain.now|crmDate:'shortdate'}

https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/#date

2
  • 1
    I tried {domain.now|crmDate:'shortdate'} but it did not resolve.It only showed {domain.now|crmDate:'shortdate'} in the email.
    – EricLB
    Commented Mar 19, 2022 at 19:35
  • Ok good to know. It may also matter where you're using it. That newfangled stuff might only work in workflow message templates, not user-driven message templates. Even for the capture solution, if using in user-driven templates it will need define('CIVICRM_MAIL_SMARTY', 1); in civicrm.settings.php to enable smarty processing.
    – Demerit
    Commented Mar 19, 2022 at 19:48

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.