Search code examples
datetimefreemarkerjodatime

Does Freemarker have any integration for JodaTime?


Are there any ways to easy format Joda DateTime objects in Freemarker? For example with Java dates, we could use the ?string and other directives.

I know I could call toDate and get a Java Date, but I was hoping there was a better way.


Solution

  • You should be able to call the toString(String pattern) method directly from Freemarker:

    ${dateTime.toString('MM-dd-yy')}

    (not tested)