Answers.Body: <p>I had been looking for something similar and wanted to follow up for anyone reading this post. (I would have left a comment on Demerit's answer but wanted to include a tad more info.)</p>
  <p>I could not get the token modifiers listed to work in Civi 5.57.4 on Drupal 7, PHP 8.025 (even though it says they work in 5.43 and up, perhaps I have some customization causing a conflict).</p>
  <p>I was able to get them to work on the Dmaster today though - it is running 5.61.alpha1 on Drupal 7 and PHP 7.4.33. I found that you can use those for core date but not custom date fields, here's a printout:</p>
  <pre><code>Date of birth  
  {contact.birth_date} : December 1st, 1980
  {contact.birth_date|crmDate:&quot;Year&quot;} : 1980
  
  Custom Date token
  {contact.custom_3} : 03/01/2023
  {contact.custom_3|crmDate:&quot;Year&quot;} : 03/01/2023
  </code></pre>
  <p>I'm guessing that the fact that the custom date token formats differently out of the gate is part of the reason it doesn't work.</p>
  <p>For fun, I also tried the smarty modifier |date_format:&quot;%Y&quot; but that produces an error: Invalid token filter: [&quot;date_format&quot;,&quot;%Y&quot;] so they've shored up that part of the code to help show errors.</p>
  <hr />
  <p>Additional information based on Demerit's comments. While the crmDate token modifiers didn't work for a custom field Demerit was spot on.</p>
  <blockquote>
  <p>For the custom one, if you know the date format is always mm/dd/yyyy,
  you could do {capture
  assign=foo}{contact.custom_3}{/capture}{$foo|substring:6:4}, and
  actually I don't think you need the capture, just some quotes:
  {&quot;{contact.custom_3}&quot;|substring:6:4}</p>
  </blockquote>
  <p>The capture method worked perfectly for me.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T21:31:25.890Z
Answers.Text: Just adding that even if date_format worked, it's deprecated since it uses strftime() which is deprecated in php.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T21:38:20.323Z
Answers.Text: For the custom one, if you know the date format is always mm/dd/yyyy, you could do `{capture assign=foo}{contact.custom_3}{/capture}{$foo|substring:6:4}`, and actually I don't think you need the capture, just some quotes: `{"{contact.custom_3}"|substring:6:4}`
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-31T22:19:57.710Z
Answers.Text: Demerit, as always, you're a magician. I got the capture version to work!!! SUPER helpful! I will edit my answer to reflect your additions.
Answers.UserDisplayName: RayWright
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T21:09:13.450Z
Answers.LastActivityDate: 2023-03-31T22:23:32.343Z
Answers.LastEditDate: 2023-03-31T22:23:32.343Z
Answers.UserDisplayName: RayWright
Answers.Body: <p>It <em>might</em> work to use crmDate as described at <a href="https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/#date" rel="nofollow noreferrer">https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/#date</a>, i.e.</p>
  <p><code>{latestcurrentmembership.join_date|crmDate:&quot;Year&quot;}</code></p>
  <p>However not everything listed there works everywhere in all versions so I don't know offhand if that works in your version of civi in scheduled reminders. Only one way to find out!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-22T18:00:16.387Z
Answers.Text: Thanks for the suggestion, but no luck when I tried it. I'll keep at!
Answers.UserDisplayName: JamesA
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-24T11:09:07.690Z
Answers.Text: Maybe {$latestcurrentmembership.join_date|date_format:"%Y"} ? That would however be using smarty - not sure if that works in scheduled reminders...
Answers.UserDisplayName: Fabian
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-22T03:33:40.570Z
Answers.LastActivityDate: 2022-09-22T03:33:40.570Z
Answers.UserDisplayName: Demerit
Body: <p>I'm trying to set up membership renewal reminder letters, and instead of including the entire date that the member joined, we'd like it to just be the year. I have a token for &quot;latestcurrentmembership.join_date&quot; that adds that date as &quot;January 1, 2022.&quot; Is there a way to have the token only add &quot;2022&quot; to the letter?</p>
  
Tags: <civimail><civimember><tokens>
Title: Using a Token to Pull Only the Year from a Date
ThreadText: # Using a Token to Pull Only the Year from a Date
  
  (Asked by: username_0 on 2022-09-21)
  
  I'm trying to set up membership renewal reminder letters, and instead of including the entire date that the member joined, we'd like it to just be the year. I have a token for "latestcurrentmembership.join\_date" that adds that date as "January 1, 2022." Is there a way to have the token only add "2022" to the letter?
  
  **Tags:** civimail, civimember, tokens
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-03-29. Score: 1
  
  I had been looking for something similar and wanted to follow up for anyone reading this post. (I would have left a comment on username_2's answer but wanted to include a tad more info.)
  I could not get the token modifiers listed to work in Civi 5.57.4 on Drupal 7, PHP 8.025 (even though it says they work in 5.43 and up, perhaps I have some customization causing a conflict).
  I was able to get them to work on the Dmaster today though - it is running 5.61.alpha1 on Drupal 7 and PHP 7.4.33. I found that you can use those for core date but not custom date fields, here's a printout:
  Date of birth  
  {contact.birth_date} : December 1st, 1980
  {contact.birth_date|crmDate:"Year"} : 1980
  
  Custom Date token
  {contact.custom_3} : 03/01/2023
  {contact.custom_3|crmDate:"Year"} : 03/01/2023
  
  I'm guessing that the fact that the custom date token formats differently out of the gate is part of the reason it doesn't work.
  For fun, I also tried the smarty modifier |date_format:"%Y" but that produces an error: Invalid token filter: ["date_format","%Y"] so they've shored up that part of the code to help show errors.
  
  Additional information based on username_2's comments. While the crmDate token modifiers didn't work for a custom field username_2 was spot on.
  
  For the custom one, if you know the date format is always mm/dd/yyyy,
  you could do {capture
  assign=foo}{contact.custom_3}{/capture}{$foo|substring:6:4}, and
  actually I don't think you need the capture, just some quotes:
  {"{contact.custom_3}"|substring:6:4}
  
  The capture method worked perfectly for me.
  
  > **Comments:**
  > **username_2**: Just adding that even if date_format worked, it's deprecated since it uses strftime() which is deprecated in php.  
  > **username_2**: For the custom one, if you know the date format is always mm/dd/yyyy, you could do `{capture assign=foo}{contact.custom_3}{/capture}{$foo|substring:6:4}`, and actually I don't think you need the capture, just some quotes: `{"{contact.custom_3}"|substring:6:4}`  
  > **username_1**: username_2, as always, you're a magician. I got the capture version to work!!! SUPER helpful! I will edit my answer to reflect your additions.  
  
  ---
  
  ### Answer by username_2 on 2022-09-22. Score: 0
  
  It *might* work to use crmDate as described at <https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/#date>, i.e.
  
  `{latestcurrentmembership.join_date|crmDate:"Year"}`
  
  However not everything listed there works everywhere in all versions so I don't know offhand if that works in your version of civi in scheduled reminders. Only one way to find out!
  
  > **Comments:**
  > **username_0**: Thanks for the suggestion, but no luck when I tried it. I'll keep at!  
  > **username_3**: Maybe {$latestcurrentmembership.join_date|date_format:"%Y"} ? That would however be using smarty - not sure if that works in scheduled reminders...  
  
  ---
  
  