Set the template date format


This article describes how to set the formatting of dates when they are printed from Freemarker.

Freemarker uses server locale settings to determing the default date format. This can be changed within the template to any desired format.

The setting determines the date format used when you use the ?date built-in. Corresponding settings are also available to set the default time and datetime formats.

Override the default date format

The date setting can be used to define a default format to use when a date is printed from a Freemarker template. This can be set in your .ftl file or an imported macro library.

e.g. Set date to print as d MMM YYYY format.

<#setting date_format="d MMM yyyy">

Further reading