with {{ block.timeLimit|date('M d Y H:i')}} i can get the real Date & Time in always the real Language from the Site. If the Page is German output is Dez, in English output is Dec.

How can i set the output of this Date always to en? Whatever language the Site has?

Thanks for every help!

  • Why can’t your date fields just be numeric?
    – Brett
    Dec 2 '18 at 0:37
  • That is not a option. I need it in english. I can't get it, is it that complicated? :D
    – askino
    Dec 2 '18 at 11:41
  • You could make a twig filter to do this (or I might if there really is a need for this). From the little reading I’ve done so far, |date runs on PHPs datetime and messing with language requires locale changing.... etc. didn’t see a way to do this with |date Dec 9 '18 at 1:16

I made a plugin to do this.


Use it just like the |date filter (new filter is |dated) and pass it the date format and the locale you would like to use. In you case the locale would be 'en'.

Example from your question:

{{ block.timeLimit|dated('M d Y H:i', 'en') }}

This will always output an English date.

If you have any issues with it, just submit an issue via GitHub.

It's available via packagist so you can run

composer require indigoviking/translitedated

And it is in process to be approved on the plugin store (should only be a day or so. If you need more features/requests/or help with it, please let me know!


You can do this in Twig as well (without a plugin):

{% set formatter = create({ class: 'craft\\i18n\\Formatter', locale: 'en' }) %}
{{ formatter.asDate(now, 'php:j F Y') }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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