FreeMarker当前日期比较 [英] FreeMarker Current Date Comparison

查看:292
本文介绍了FreeMarker当前日期比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在freemarker模板中与当前日期进行日期比较,而无需将当前日期传递到模板中?

Is it possible to do date comparisons against the current date in a freemarker template without passing the current date into the template?

推荐答案

来自 FreeMarker 2.3.17 可以使用新的特殊变量 .now :

From FreeMarker 2.3.17 on you can use the new special variable .now:

[#assign foo = .now > yesterday?datetime]

这篇关于FreeMarker当前日期比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆