Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a multilingual site, and I want my dates formatted like:

  • English site: July 13, 2014
  • Italian site: 13 lulgio 2014

So the month name is translated, and the order of the elements changes as well.

share|improve this question
up vote 9 down vote accepted

Craft has extended Twig's date filter so that it translates the output (no documentation for this, but the code is in craft/app/etc/templating/twigextensions/CraftTwigExtension.php around line 152). So {{now|date('F j, Y')}} will give July 13, 2014 on the English site, and luglio 13, 2014 on the Italian site. Which is half way there. In order to get the Italian date to use the Italian format (j F Y), we need a translation for the format string. Add this to craft/translations/it.php. (For more info see Static Translations):

'F j, Y' => 'j F Y',

To output the translated date:

{{now|date('F j, Y'|t)}}
share|improve this answer

If you don't need to customized the output you can also use the Crafts datetime methods localeDate() and localeTime() to return a date / time in the current locale's preferred date format.

{# Returns '7/15/2014' if current locale is 'en' #}
{# Returns '15.07.2014' if current locale is 'it' #}
{{ now.localeDate() }
share|improve this answer
How do you set the preferred format for the locale? – Marion Newlevant Jul 15 '14 at 3:58
I don't think you can, @Marion. That's why your approach is better if you have a need to customize the output. – carlcs Jul 15 '14 at 8:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.