Answers.Body: <p>Found the answer. The civi field token must be captured to a Smarty variable first:</p>
  
  <pre><code>{capture assign=arr}{contact.custom_105}{/capture}{$arr|date_format:"%A, %B %e, %Y"}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-08T00:11:45.790Z
Answers.Text: 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.
Answers.UserDisplayName: Mick Kahn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-18T16:45:32.287Z
Answers.LastActivityDate: 2018-04-18T16:45:32.287Z
Answers.UserDisplayName: Phil Morice Brubaker
Body: <p>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:</p>
  
  <pre><code>{contact.custom_105|date_format:"%A, %B %e, %Y"}
  </code></pre>
  
  <p>But the mail send hangs. Also hangs if I just use</p>
  
  <pre><code>{contact.custom_105|date_format}
  </code></pre>
  
  <p>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.</p>
  
  <p>How can I get this formatted as I want?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-01T17:40:43.590Z
Comments.Text: I confirm it does not work, a data custom field is returned as a string and it is not recognised by smarty as a datestamp. This is probably a bug
Comments.UserDisplayName: Marco Mercinelli
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-02T18:02:17.413Z
Comments.Text: Hmm. There must be something else going on. I tested the exact code in my answer above with a direct Email (not in  a message template) and it returned "Thursday, March 3, 2022". Are you sure your custom field is a Date field?
Comments.UserDisplayName: Phil Morice Brubaker
Tags: <custom-fields><smarty><dates>
Title: Custom date field formatting with smarty
ThreadText: # Custom date field formatting with smarty
  
  (Asked by: username_0 on 2018-04-18)
  
  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?
  
  **Tags:** custom-fields, smarty, dates
  
  > **Comments:**
  > **username_1**: I confirm it does not work, a data custom field is returned as a string and it is not recognised by smarty as a datestamp. This is probably a bug  
  > **username_0**: Hmm. There must be something else going on. I tested the exact code in my answer above with a direct Email (not in  a message template) and it returned "Thursday, March 3, 2022". Are you sure your custom field is a Date field?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-04-18. Score: 5 | Accepted answer
  
  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"}
  
  > **Comments:**
  > **username_2**: 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.  
  
  ---
  
  