使用Mako模板格式化日期

Dav*_*lva 7 python mako pyramid

在我的mako模板中,我有:

<p>${item.addDate}</p>
Run Code Online (Sandbox Code Playgroud)

它返回:

2012-12-27 19:50:00

但我想得到:

27/12/2012 19:50

有mako任何漂亮的过滤器,格式化功能?

Mic*_*ann 11

根据谷歌,strftime应该做的工作:

${post.date.strftime('%Y/%m/%d %H:%M')
Run Code Online (Sandbox Code Playgroud)

另外,根据谷歌:

<%! from time import strftime as time %>
It is the ${"%d of %B" | time}
Run Code Online (Sandbox Code Playgroud)