Important: Note that date formatting follows the ICU convention and is case sensitive. For more information see the ICU Project details.
It is a date formatting function. It displays the date of the specified country and it can also translate this date (it can handle the PHP language translations). Please note that it displays only the date, even if the time is also provided. It can be overwritten, so the predefined date format becomes displayed (e.g. [{locale: en, format: yyyy mm}] means that the format YYYY MM will become visible for English people.) The localized_date filter can have 4 parameters. These are displayed in the order defined by their language settings, and contain the following:
- full: year, month, date, day of the week
- long: year, month, date
- medium: year, abbreviated version of month, date
- short: yyyy/MM/dd, the separator can be different.
The month can be displayed in the following ways:
Syntax | Displayed format |
---|---|
M | 9 |
MM | 09 |
MMM | Sep |
MMMM | September |
MMMMM | S |
For further syntax of the date/time format, see here.
The input string can have the following formats:
- 'yyyy-MM-dd'
- 'now'
- '+[number] hours'
- '+[number] days'
- '-[number] hours'
- '-[number] days'
In this example, a full version is provided on the basis of the stored country+language value in contact field 12 for the specified date (e.g. it will become January 1 Friday, 1999).
{{ '1999-01-01'|localized_date(contact.12, 'full') }}
Important: Ensure that all the fields have valid and relevant data values. The localized_date filter cannot format empty fields which may lead to an error in the Contact preview.
You can also use a database field placeholder to populate the date dynamically. If you do this, make sure to leave out the single quotes around the field placeholder, as the date value will be returned in quotes. In this example we use value of contact field 12345 to provide the date.
{{ contact.12345|localized_date(contact.12, 'full') }}
As another example, you can have "x days from now" date, too.
{{ '+7 days'|localized_date('de','dd.MM.yyyy') }}