Reputation: 35
How to print a variable in twig html file such as for date:
{{ timeComment|date('Y-m-d') }}
I've tried date('Y-m-d H:i:s')
but it doesn't work.
Upvotes: 1
Views: 1374
Reputation: 4265
If you want to print the current datetime, you can do this:
{{ "now"|date('Y-m-d H:i:s') }}
See http://twig.sensiolabs.org/doc/filters/date.html for details.
Upvotes: 2