dateFormat

Formats a date variable using a specified format string. The format string must be a valid DateTime format. Month and weekday names are automatically translated based on a given locale. To reference the current date, use the :now variable.

@{ date | dateFormat (format) }

Parameters

format "D, d M Y"
A valid DateTime format string. The default is "D, d M Y".
locale null
An optional locale that can be used for date string translations.

Examples

The following example shows a typical human-readable long-format date starting with a textual representation of a day with three letters, followed by the day of the month, a short textual representation of a month, and a four-digit representation of the year. The :lang runtime variable is passed as the locale here.

@{ date | dateFormat ('D, d M Y', @{ :lang }) }

Another typical case for dateFormat is a copyright notice in the footer that can be added as a snippet as follows:

© @{ :now | dateFormat('Y') } by @{ sitename }
ceil def