QUANTM7 Docs

Date Filters

Format dates and times using strftime patterns.

The date filter formats a date value into a readable string. It uses strftime format codes to control the output.

Basic usage

{{ product.created_at | date: '%B %d, %Y' }}

Output: July 03, 2026

The format string uses codes that start with %. Each code is replaced with a part of the date.

Current date

Use the string 'now' to get the current date and time:

{{ 'now' | date: '%Y-%m-%d' }}

Output: 2026-07-03

Format codes

Here are the most common codes:

CodeMeaningExample
%YFour-digit year2026
%yTwo-digit year26
%mMonth as a number (zero-padded)07
%BFull month nameJuly
%bShort month nameJul
%dDay of the month (zero-padded)03
%eDay of the month (space-padded) 3
%AFull weekday nameThursday
%aShort weekday nameThu
%HHour in 24-hour format14
%IHour in 12-hour format02
%MMinutes30
%SSeconds45
%pAM or PMPM
%ZTime zone nameUTC
%%A literal % character%

Common patterns

Date only

{{ order.created_at | date: '%d %B %Y' }}

Output: 03 July 2026

Date and time

{{ order.created_at | date: '%d %b %Y at %H:%M' }}

Output: 03 Jul 2026 at 14:30

ISO 8601

Useful for <time> elements and structured data:

<time datetime="{{ product.created_at | date: '%Y-%m-%dT%H:%M:%S%z' }}">
  {{ product.created_at | date: '%B %d, %Y' }}
</time>

Short date

{{ order.created_at | date: '%d/%m/%Y' }}

Output: 03/07/2026

Month and year

{{ article.published_at | date: '%B %Y' }}

Output: July 2026

time_tag

Generate a semantic HTML <time> element with the correct datetime attribute:

{{ product.created_at | time_tag }}

Output:

<time datetime="2026-07-03T14:30:00Z">July 03, 2026</time>

Pass a format string to control the visible text:

{{ order.created_at | time_tag: '%d %b %Y' }}

Output:

<time datetime="2026-07-03T14:30:00Z">03 Jul 2026</time>

The datetime attribute always uses ISO 8601 format, regardless of the display format you choose. This helps search engines and screen readers understand dates correctly.

Tips

The date filter works with any value that represents a date. This includes ISO 8601 strings, Unix timestamps, and date objects from the platform.

If the input value is not a valid date, the filter returns the input unchanged. It does not throw an error.

Plain text around the format codes is kept as-is:

{{ order.created_at | date: 'Placed on %B %d, %Y' }}

Output: Placed on July 03, 2026

On this page