1

I'm trying to format a custom date field using smarty to send emails. What I want is to have the day of the week included, as "Wednesday, April 18, 2018". It seems that this should work:

{contact.custom_105|date_format:"%A, %B %e, %Y"}

But the mail send hangs. Also hangs if I just use

{contact.custom_105|date_format}

I can use {contact.custom_105} to send the preformatted date "03/01/2018 3:15AM", so I know I'm working with the correct field.

How can I get this formatted as I want?

3

Found the answer. The civi field token must be captured to a Smarty variable first:

{capture assign=arr}{contact.custom_105}{/capture}{$arr|date_format:"%A, %B %e, %Y"}
  • This doesn't seem to work for me and still hangs. I think the problem may be that the custom field comes in as a string rather than a datestamp and I think its still a string from the capture/assign. – Mick Kahn Dec 8 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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