date - Liquid Filter Reference - 0.11.3

Filter Name date
Group Dates
Version 0.11.3

Description

Converts a timestamp into another date format. The format for this syntax is the same as strftime. The input uses the same format as Ruby’s Time.parse.

Examples

{{ publish_on | date: "%a, %b %d, %y" }}
Thu, Jul 01, 21
{{ "2021-07-01T09:00:00Z" | date: "%Y" }}
2021
date works on strings if they contain well-formatted dates:
{{ "March 14, 2016" | date: "%b %d, %y" }}
Mar 14, 16
To get the current time in UTC, pass the special word “now” (or “today”) to date:
{{ "now" | date: "%Y-%m-%d %H:%M" }}
2021-06-30 23:00

Options

timezone

Converts the timestamp into the supplied timezone before formatting

{{ "2021-07-01T09:00:00Z" | date: "%Y-%m-%d %H:%M", timezone: "Australia/Sydney" }}
2021-07-01 19:00

Back to Filter List

Back to Liquid Reference for 0.11.3

 

 
Back to Documentation