datetime - Liquid Filter Reference - 1.0.0

Filter Name datetime
Group Dates
Version 1.0.0

Description

Converts a date/time string to a valid timestamp

Examples

When no timezone is provided, it assumes the timezone is UTC:
{{ "2021-02-01 09:00" | datetime }}
2021-02-01T09:00:00Z
When a timestamp with an offset is provided, it converts the timestamp to UTC:
{{ "2021-06-01T09:00:00+10:00" | datetime }}
2021-05-31T23:00:00Z

Options

timezone

Converts a timestamp to the given timezone

When a timestamp with an offset is provided, it converts the timestamp to the given timezone:
{{ "2021-06-01T09:00:00+10:00" | datetime, timezone: "Pacific/Auckland" }}
2021-06-01T11:00:00+12:00
When the date is during daylight savings, it adjusts the timestamp’s offset to the daylight savings offset for the given timezone:
{{ "2021-02-01 09:00" | datetime, timezone: "Australia/Sydney" }}
2021-02-01T09:00:00+11:00
When the date is not during daylight savings, it leaves the timestamp’s offset at the regular offset for the given timezone:
{{ "2021-06-01 09:00" | datetime, timezone: "Australia/Sydney" }}
2021-06-01T09:00:00+10:00

Back to Filter List

Back to Liquid Reference for 1.0.0

 

 
Back to Documentation