How can I get timestamp value in twig as I know date formatting is possible in twig but don't know how to get timestamp value using twig function;
如何在twig中获取时间戳值,因为我知道在twig中可以进行日期格式化,但是不知道如何使用twig函数获取时间戳值;
2 个解决方案
#1
40
You can use this
你可以用它
{{ date().timestamp }}
{{date()。timestamp}}
#2
40
There is other solution that might be easier to understand by designers.
设计师可能更容易理解其他解决方案。
{{ 'now'|date('U') }}
{{'now'| date('U')}}
(I am aware that the question is already answered and it's old)
(我知道这个问题已经回答了,现在已经很久了)
#1
40
You can use this
你可以用它
{{ date().timestamp }}
{{date()。timestamp}}
#2
40
There is other solution that might be easier to understand by designers.
设计师可能更容易理解其他解决方案。
{{ 'now'|date('U') }}
{{'now'| date('U')}}
(I am aware that the question is already answered and it's old)
(我知道这个问题已经回答了,现在已经很久了)