Get current date in Thymeleaf
date, java, spring, thymeleaf
Solution
Try with this:
${#dates.format(#dates.createNow(), 'dd MMM yyyy HH:mm')}
will be created a `java.util.Date()` object then formatted as you prefer.
Using the `#calendars` utility object
This is an alternative method:
${#calendars.format(#calendars.createNow(), 'dd MMM yyyy HH:mm')}
the result will be the same.
Problem
How can I print current date (and time, eventually) from Thymeleaf? I'm trying these functions: http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#dates but I can't get them work.