Download

{{date}} helper

Generate the date in the specified format.

The date format must be compatible with the moment().js library. This flexibility now extends to specifying the language for the output, accommodating scenarios where you need to format dates in a language different from the main language of your site.

Syntax:

{{date timestamp "format" [omitTz] "locale"}}

The format is optional. If not specified, then the MMM Do YYYY format is used. The newly added fourth parameter, locale, specifies the language code (e.g., 'en' for English, 'fr' for French) for the date output.

Example:

{{date createdAt 'YYYY-MM-DDTHH:mm' false 'en'}}

In the above example, the date is formatted according to the specified format and language code, allowing for displaying dates in English on a site primarily in another language, such as French. This is particularly useful for content like RSS feeds, where standardized date formatting in a specific language might be required regardless of the site's primary language setting.

What are you waiting for?

Start building your site today.

  1. 1 Download Publii
  2. 2 Write your content
  3. 3 Publish your site
Create website