Is it possible to do date comparisons against the current date in a freemarker template without passing the current date into the template?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
From FreeMarker 2.3.17 on you can use the new special variable .now
:
[#assign foo = .now > yesterday?datetime]
回答2:
NO
Freemarker is a templating library, there isn't a today variable.
But you can pass a new Date()
Java Object to the template.
标签:
freemarker