Ordinal Suffix in Smarty Templates

robin's Avatar

robin

15 Mar, 2013 01:23 PM

This comment was split from the discussion: How can I change the name of my 3 products in 3 currencies to something more meaningful?

Hi Marc,

Another question:

How do you set the date format in emails to display the suffix for numbers to display: 1st, 2nd, 3rd, 4th.....21st and so on. We'd like to be able to tell users they will be billed on the x(th, rd, nd) day of the month.

Best,

Robin

  1. Support Staff 1 Posted by Marc Guyer on 15 Mar, 2013 01:25 PM

    Marc Guyer's Avatar

    The email templates use Smarty syntax. Here's the reference:

    http://www.smarty.net/docs/en/smarty.for.designers.tpl

    You're looking for the data_format function:

    http://www.smarty.net/docs/en/language.modifier.date.format.tpl

    What is required to show the ordinal suffix is unfortunately not documented there. You can also use additional format syntax like PHP's date() function http://www.php.net/manual/en/function.date.php with the Smarty date_format function. So, if you want to use the ordinal suffix, you can do this:

    ... on the {$invoice.billingDatetime|date_format:"jS"} of the month...
    
  2. Jess Pendley closed this discussion on 21 Nov, 2013 07:36 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM