Date

The date helper can be used to format date and time values.

The first parameter is the datetime to format and the second is the format string; as a convenience various default formats are exposed to your templates to save constructing format strings for the common cases.

{{date file.modified "%a %b %e %Y"}}

Which gives the result:

Thu Feb 11 2021

Specifying a format string is far from ideal so templates are passed a date.formats object containing some useful pre-defined formats:

{{date file.modified @root/date.formats.date-medium}}

Which is equivalent to the explicit format example above.

Next we look at the built-in convenience formats; see the list of format specifiers for more information on creating your own formats.

You may configure format specifiers, see settings for more information.

Local

All datetime values are UTC if you want to account for the local time zone use the local hash parameter:

{{date file.modified @root/date.formats.date-medium local=true}}

Date

Here are all the built-in formats for date:

Time

Here are all the built-in formats for time:

Both time-short and time-medium are the 24-hour clock; time-long is the 12-hour clock.

Date & Time

Here are all the built-in formats for date and time:

Back to Helpers