Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the default date format for Twig templates in Symfony2?

Tags:

twig

symfony

Twig documentation describes how to set the default date format for the date filter:

$twig = new Twig_Environment($loader);
$twig->getExtension('core')->setDateFormat('d/m/Y', '%d days');

How can do this setting globally in Symfony2?

like image 575
Philipp Rieber Avatar asked Mar 27 '12 08:03

Philipp Rieber


1 Answers

for Symfony 4 you can do this for those that need.

twig:
    ...
    date:
        format: c
        timezone: UTC
    ....
like image 193
Chris Avatar answered Oct 25 '22 19:10

Chris