5

I have a Search Kit search that shows the date like this: November 1st, 2012 12:00 AM. I want to reformat this as 11/01/22. How can I do this?

1 Answer 1

10
  • You must be on CiviCRM 5.47+ to have the "Use Smarty in Search Kit rewrites" feature.
  • Create a Search Display based on your search - e.g. Add » Table using the Add button in the left pane.
  • Find your date field and check the Rewrite box. You'll see a token that represents your date, e.g. [receive_date].
  • Change the rewrite value to the following. Substitute your token for [receive_date] below.
{"[receive_date]"|date_format:"%D"}

A full list of date formatting options is available in the Smarty date_format documentation.

(Ignore the older rewrite text in the screenshot, the value above is the improved version!)

enter image description here

2
  • 0 Do you have to enable the smarty option? We have tried the above but all the dates are coming out as todays date in the output Olly Commented Jun 29, 2022 at 11:22
  • @OliverGibson There's nothing you need to set. I just recreated this on a brand new Civi and took a screenshot, which I added to the answer. Hopefully this clears things up? If not, hit me up on chat (@junglebird) Commented Jun 29, 2022 at 19:41

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.