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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With