date - Liquid Filter Reference
On this page
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.
| Property | Value |
|---|---|
| Return Type | string |
| Category | dates |
Options
| Option | Description |
|---|---|
timezone |
Converts the timestamp into the supplied timezone before formatting |
Examples
liquid
{{ "2021-07-01" | date: "%a, %b %d, %y" }}
Output: Thu, Jul 01, 21
liquid
{{ "2021-07-01" | date: "%Y" }}
Output: 2021
date works on strings if they contain well-formatted dates
liquid
{{ "March 14, 2016" | date: "%b %d, %y" }}
Output: Mar 14, 16
liquid
{{ "2021-06-30T13:00:00Z" | date: "%Y-%m-%d %H:%M", timezone: "Australia/Sydney" }}
Output: 2021-06-30 23:00