<p>If you don't need to customized the output you can also use the Crafts datetime methods <a href="http://buildwithcraft.com/docs/templating/datetime#localeDate" rel="nofollow"><code>localeDate()</code></a> and <a href="http://buildwithcraft.com/docs/templating/datetime#localeDate" rel="nofollow"><code>localeTime()</code></a> to return a date / time in the current locale's preferred date format.</p>

<pre><code>{# Returns '7/15/2014' if current locale is 'en' #}
{# Returns '15.07.2014' if current locale is 'it' #}
{{ now.localeDate() }
</code></pre>

CC BY-SA 3.0
2014-07-15T03:58:45.690Z
How do you set the preferred format for the locale?
Marion Newlevant
CC BY-SA 3.0
2014-07-15T08:53:10.610Z
I don't think you can, @Marion. That's why your approach is better if you have a need to customize the output.
carlcs
CC BY-SA 3.0
2014-07-15T00:17:54.280Z
2014-07-15T00:17:54.280Z
carlcs
<p>Craft has extended Twig's <a href="http://twig.sensiolabs.org/doc/filters/date.html">date filter</a> so that it translates the output (no documentation for this, but the code is in <em>craft/app/etc/templating/twigextensions/CraftTwigExtension.php</em> around line 152). So <code>{{now|date('F j, Y')}}</code> will give <strong>July 13, 2014</strong> on the English site, and <strong>luglio 13, 2014</strong> on the Italian site. Which is half way there. In order to get the Italian date to use the Italian format (<em>j F Y</em>), we need a translation for the format string. Add this to <em>craft/translations/it.php</em>. (For more info see <a href="http://buildwithcraft.com/help/static-translations">Static Translations</a>):</p>

<pre><code>'F j, Y' =&gt; 'j F Y',
</code></pre>

<p>To output the translated date:</p>

<pre><code>{{now|date('F j, Y'|t)}}
</code></pre>

CC BY-SA 3.0
2014-07-14T02:07:52.630Z
2014-07-14T02:07:52.630Z
Marion Newlevant
<p>I have a multilingual site, and I want my dates formatted like:</p>

<ul>
<li>English site: July 13, 2014</li>
<li>Italian site: 13 lulgio 2014</li>
</ul>

<p>So the month name is translated, and the order of the elements changes as well.</p>

<templating><date><localization>
Multilingual Dates where date format varies
# Multilingual Dates where date format varies

(Asked by: username_0 on 2014-07-14)

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.

**Tags:** templating, date, localization

---

## 2 answers

### Answer by username_0 on 2014-07-14. Score: 15 | Accepted answer

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)}}


---

### Answer by username_1 on 2014-07-15. Score: 1

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() }

> **Comments:**
> **username_0**: How do you set the preferred format for the locale?  
> **username_1**: I don't think you can, @Marion. That's why your approach is better if you have a need to customize the output.  

---

