FreeMarker Current Date Comparison

Rich picture Rich · Sep 3, 2009 · Viewed 16.4k times · Source

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

Answer

Chaquotay picture Chaquotay · Jun 6, 2011

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

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