Skip to content

Developers · Pages and Layouts

Date Format

Last updated 1 November 2026

Show dates and times consistently with the l filter and named formats in your translation file.

Use the l filter to show dates and times in the same format across your whole site. You name a format once, in your translation file, and every page that uses that name follows it. localize is another name for the same filter.

The built-in formats

Each format is a translation key under time.formats. These are the results for 2026-11-01T11:45:00Z on an instance with no overrides:

FormatResult
none (the default)Sun, 11/01/2026 11:45
longSun, 11/01/2026 11:45
short11:45
with_time_zone11/01/2026 11:45 (UTC)
short_with_time_zone11:45 (UTC)
day_month_year01-11-2026
day_and_monthNov 01

Example

insites-cli exec liquid docs57 "{% assign d = '2026-11-01T11:45:00Z' %}{{ d | l: 'short' }} / {{ d | l: 'day_month_year' }} / {{ d | l: 'long', 'Asia/Makassar' }}"
11:45 / 01-11-2026 / Sun, 11/01/2026 19:45

This ran on the docs.insites.io instance on 1 November 2026. The second argument is a time zone, so one stored time can be shown in the reader's zone.

Change a format or add your own

Override a format, or add a new name, in the translation file for the language:

app/translations/en.yml

en:
  time:
    formats:
      short: "%-H:%M"
      long: "%a, %m/%d/%Y %H:%M"
      day_month_year: "%d-%m-%Y"

The values use strftime directives: %d is the day, %m the month, %Y the year, %H and %M the hour and minute, and a - drops the leading zero. For a one-off format, the strftime filter takes the pattern directly: {{ d | strftime: '%B %d, %Y' }} gives November 01, 2026.

Common mistakes

  • Asking for a format that is not defined, such as medium or full. The filter fails with Translation missing: en.time.formats.medium. Define it first.
  • Passing a date with no time. '2026-11-01' | l showed 12:00, not midnight, so use a date format that leaves out the time.
  • Using strftime everywhere. It ignores your named formats and the time zone argument.