Skip to documentation content

Date Filters

Date Filters

Liquid filters for dates and times (format, add days, etc.).

add_years filter

Return a date object operand years in the future from the input date.

add_years: integer operand

If operand is negative, return a date that many years in the past from the input date.

Example Count client sessions within a time window (e.g. one year)Count how many sessions the client has had within a time window (e.g. one year) for analytics or limits.
Liquid
{%- if client.allowed and client.num_sessions > 6 and client.VIP != "true" and client.first_request_date < request.date | add_years: -1 -%}
	<p>You have viewed this site {{ client.num_sessions }} since {{ client.first_request_date | date: 'MMMM yyyy' }}. During that time you have looked at {{ client.num_pages }} pages. We are happy that you have taken so much interest in us, and would like to invite you to <a href="#"> join our VIP club</a>!</p>
{%- endif -%}
Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

add_weeks filter

Return a date object operand weeks in the future from the input date.

add_weeks: integer operand

If operand is negative, return a date that many weeks in the past from the input date.

Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

add_seconds filter

Return a date object operand seconds in the future from the input date.

add_seconds: integer operand

If operand is negative, return a date that many seconds in the past from the input date.

Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

add_months filter

Return a date object operand months in the future from the input date.

add_months: integer operand

If operand is negative, return a date that many months in the past from the input date.

Example Fetch calendar_entries for the next month using assign and date filtersSet a date range (e.g. from now to one month ahead) and fetch calendar_entries into the template.
Liquid
{%- assign minDate = "now" | midnight -%}
{%- assign maxDate = minDate | add_months: 1 -%}
{%- calendar_entries output_to_template start_date:minDate end_date:maxDate limit:30 sort_by:"start_date" sort_direction:"asc" -%}
Example Get Calendar Entries for the Next MonthSet a date range with midnight and add_months, then fetch the next 30 calendar_entries sorted by start_date.
Liquid
{%- var minDate = "now" | midnight -%}
{%- var maxDate = "now" | midnight | add_months: 1 -%}
{%- calendar_entries var entries = start_date:minDate end_date:maxDate limit:30 sort_by:"start_date" sort_direction:"asc" -%}
Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

add_minutes filter

Return a date object operand minutes in the future from the input date.

add_minutes: integer operand

If operand is negative, return a date that many minutes in the past from the input date.

Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

add_hours filter

Return a date object operand hours in the future from the input date.

add_hours: integer operand

If operand is negative, return a date that many hours in the past from the input date.

Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

add_days filter

Return a date object operand days in the future from the input date.

add_days: integer operand

If operand is negative, return a date that many days in the past from the input date.

Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM

date filter

Returns the input as a date. If format is specified, converts the date to a string before returning it using the given format. The format must be a valid standard or custom .NET date format.

date: string format

If the input is already a date object, it will be used as-is - either to be formatted or returned without alteration. If the input is a number, it will be interpreted as a unix timestamp - that is the seconds since the Unix Epoch (midnight on January 1, 1970 UTC). If the input is not already a date and is not a number, it will attempt to parse it as the string representation of a date. If the input cannot be converted to a date using any of the previous methods, it will use the current date and time - which will prevent the page from being fast-cached. In all cases where the date filter creates a new date object, it uses the current timezone - which defaults to the site&#39;s timezone but may be set explicitly using the {% set_timezone %} method.

Example Format an entity date field with the date filterFormat an entity date field (e.g. date_opened) for display using the date filter.
Liquid
{%- if entity.date_opened.is_valid -%}
	<p><strong>Date Opened</strong>: {{ entity.date_opened | date: "MMMM dd, yyyy" }}</p>
{%- endif -%}
Example Many ways to use the date filterYou can use the date filter either to create a date object or to format a date as a string.
Liquid
{% set_timezone 'UTC' %}

create a date object

Liquid
{{ "2009-09-09" | date }}
Output
9/9/2009 12:00:00 AM
Liquid
{{ "2009-09-09" | date: "D" }}
Output
Wednesday, September 9, 2009
Liquid
{{ 0 | date: "D" }}
Output
Thursday, January 1, 1970
Liquid
{{ 1756239994 | date: "D" }}
Output
Tuesday, August 26, 2025

Defaults to the current date

Liquid
{{"now" | date}}
Output
2009-09-09T00:00:00.0000000+00:00 (or whatever the current date is)

format a date as a string

Liquid
{{request.date | date: "d"}}
Output
9/9/2009
Liquid
{{request.date | date: "D"}}
Output
Sunday, September 9, 2009
Liquid
{{request.date | date: "o"}}
Output
9/9/2009 12:00:00 AM
Liquid
{{request.date | date: "MMMM dd, yyyy"}}
Output
September 09, 2009
Example Use a post_date or date-time field with the date filterUse a post_date or other date-time field and format or compare it with the date filter and date properties.
Liquid
{%- if entity.rehearsal_start.is_valid -%}
	<p>Rehearsal will begin on {{ entity.rehearsal_start | date: "MMMM dd, yyyy 'at' h:m t" }} UTC</p>
{%- endif -%}
Example Convert or display dates in a timezone (to_timezone filter)Demonstrates multiple ways to use the to_timezone filter.

Display the article post date in multiple timezones

Liquid
{{ article.post_date | to_timezone: session.user_timezone }} local time
{{- article.post_date | to_timezone: 'UTC' }} UTC
{{- article.post_date | to_timezone: 'Europe/Rome' }} CET
Output
2026-02-16 6:00:00 local time
2026-02-16 10:00:00 UTC
2026-02-16 11:00:00 CET

Convert a date to a different timezone and display it with formatting

Liquid
{%- if entity.alt_timezone.is_valid -%}
	{{- entity.alt_date | to_timezone: entity.alt_timezone | date: 'f' }} {{ entity.alt_timezone -}}
{%- endif -%}
Output
2026-02-16 12:00:00
Example Calendar Entry time and formattingFormat a calendar entry start/end time for display using the date filter and optional timezone.
Liquid
{%- if calendar_entry.start_date.date.is_future -%}
	Event will start on {{calendar_entry.start_date | date: 'g' -}}
{%- elsif calendar_entry.end_date.date.is_future -%}
	Event is currently in progress
{%- else -%}
	Event completed on {{calendar_entry.end_date | date: 'g' -}}
{%- endif -%}
Example Count client sessions within a time window (e.g. one year)Count how many sessions the client has had within a time window (e.g. one year) for analytics or limits.
Liquid
{%- if client.allowed and client.num_sessions > 6 and client.VIP != "true" and client.first_request_date < request.date | add_years: -1 -%}
	<p>You have viewed this site {{ client.num_sessions }} since {{ client.first_request_date | date: 'MMMM yyyy' }}. During that time you have looked at {{ client.num_pages }} pages. We are happy that you have taken so much interest in us, and would like to invite you to <a href="#"> join our VIP club</a>!</p>
{%- endif -%}
Example How to use the format filter to format datesFormat dates using standard or custom .NET date formats.
Liquid
{% var sep9 = '2009-09-09 14:00:00Z' | date | to_timezone: 'America/New_York' %}

Format a date as a short date string

Liquid
{{sep9 | format: "d"}}
Output
9/9/2009

Formats a date as a short date string (d = short date).

Format a date as a short date string with the time

Liquid
{{sep9 | format: "g"}}
Output
9/9/2009 10:00 AM

Formats a date as a short date string with the time (g = short date with time).

Format a date as a long date string

Liquid
{{sep9 | format: "D"}}
Output
Sunday, September 9, 2009

Formats a date as a long date string (D = long date).

Format a date as a long date string with the time

Liquid
{{sep9 | format: "f"}}
Output
Sunday, September 9, 2009 10:00 AM

Formats a date as a long date string with the time (f = long date with time).

Format a date according to the ISO 8601 standard

Liquid
{{sep9 | format: "o"}}
Output
9/9/2009 2:00:00 PM

Formats a date according to the ISO 8601 standard (o = round trip format with offset).

Format a date as a sortable date string

Liquid
{{sep9 | format: "u"}}
Output
9/9/2009 2:00:00 PM

Formats a date as a sortable date string (u = universal sortable date in UTC timezone).

Format a date to a long date string using a custom date format string

Liquid
{{sep9 | format: "MMMM dd, yyyy 'at' HH:mm:ss"}}
Output
September 09, 2009 at 10:00:00

Formats a date using a custom .NET date format string.

Format a date to a short date string using a custom date format string

Liquid
{{sep9 | format: "hh:mm tt 'on' MM-dd-yy"}}
Output
10:00 AM on 09-09-09

Formats a date using a custom .NET date format string.

You can also use the date filter to format a date

Liquid
{{sep9 | date: "hh:mm tt 'on' MM-dd-yy"}}
Output
10:00 AM on 09-09-09

The date and format filters use the same format strings for dates, but the date filter can only be used to format dates while the format filter can also be used to format numbers and time diffs.

midnight filter

Return the input as a date at midnight of the same day. That is, with hours, minutes, and seconds set to 0.

midnight
Example Fetch calendar_entries for the next month using assign and date filtersSet a date range (e.g. from now to one month ahead) and fetch calendar_entries into the template.
Liquid
{%- assign minDate = "now" | midnight -%}
{%- assign maxDate = minDate | add_months: 1 -%}
{%- calendar_entries output_to_template start_date:minDate end_date:maxDate limit:30 sort_by:"start_date" sort_direction:"asc" -%}
Example Get Calendar Entries for the Next MonthSet a date range with midnight and add_months, then fetch the next 30 calendar_entries sorted by start_date.
Liquid
{%- var minDate = "now" | midnight -%}
{%- var maxDate = "now" | midnight | add_months: 1 -%}
{%- calendar_entries var entries = start_date:minDate end_date:maxDate limit:30 sort_by:"start_date" sort_direction:"asc" -%}
Example Using the midnight filterUse the midnight filter to get the input as a date at midnight.
Liquid
{{ request.date | midnight }}
Output
2009-09-09T00:00:00.0000000+00:00 (or whatever the current date is)
Liquid
{{ "2020-02-26 14:42:02" | midnight }}
Output
2/26/2020 12:00:00 AM
Liquid
{{ 256 | midnight }}
Output
1/1/1970 12:00:00 AM
Liquid
{{ 1756239994 | midnight }}
Output
8/26/2025 12:00:00 AM

time_diff filter

If format is unspecified, returns a time_diff object describing the difference between the current date and the other date. If format is specified, converts the time difference to a string before returning it using the given format. If supplied, the format must be a valid standard or custom .NET TimeSpan format.

time_diff: {{ time }} other, string format
Example Compute and display a time difference between two datesCompute and display a time difference between two dates.
Liquid
{%- var diff = request.date | time_diff: calendarEntry.start_date -%}
{%- var is_future = true -%}
{%- if diff.total_seconds < 0 -%}
	{%- set is_future = false -%}
{%- endif -%}
This event {% if is_future %}will start in{% else %}started{% endif -%}
	{%- if diff.days > 0 %}{{diff.days }} days{% endif -%}
	{%- if diff.hours > 0 %}{{diff.hours }} hours{% endif -%} 
	{%- if diff.minutes > 0 %}{{diff.minutes }} minutes{% endif -%} 
	{%- if diff.hours == 0 and diff.seconds > 0 %}{{diff.seconds }} seconds{% endif -%}
	{%- unless is_future %}ago{% endunless -%}
Example How to use the format filter to format time diffsFormat time diffs using standard or custom .NET TimeSpan formats.
Liquid
{% var startdate = '2009-09-09 14:00:00Z' | date | to_timezone: 'America/New_York' %}
{% var enddate = '2009-09-10 17:32:00Z' | date | to_timezone: 'America/New_York' %}
{% var diff = startdate | time_diff: enddate %}

Format a time diff as a constant time span string

Liquid
{{ diff | format: "c" }}
Output
-1.03:32:00

Formats a time diff as a constant time span string (c = constant time span).

Format a time diff as a compact time span string

Liquid
{{ diff | format: "g" }}
Output
-1:3:32:00

Format a time diff using a custom .NET TimeSpan format string

Liquid
{% if diff.total_seconds < 0 %}-{% endif %}{{ diff | format: "d' days, 'h' hours, and 'm' minutes'" }}
Output
-1 days, 3 hours, and 32 minutes

Formats a time diff using a custom .NET TimeSpan format string. Since custom .NET TimeSpan format strings do not have a way to output the minus sign for negative time spans, you have to check for negative time spans separately.

timezone filter

Returns the timezone that the date is in. If full is true or if an abbreviated timezone name is not available, returns the full timezone identifier (eg: &quot;Europe/Rome&quot;). If full is false (default) or not specified and an abbreviated timezone name is available returns the abbreviated timezone name (eg: &quot;PST&quot; or &quot;PDT&quot;).

timezone: boolean full
Example Set the request timezoneSet the request timezone from a string (e.g. IANA zone) so date/time output uses that zone.
Liquid
{%- set_timezone "America/Indianapolis" -%}
{{- request.date | timezone }}
Output
America/Indianapolis
Liquid
{%- var cityname = "Amsterdam" -%}
{%- set_timezone "Europe/" | append: cityname -%}
{{- request.date | timezone }}
Output
Europe/Amsterdam
Example Using the timezone filterUse the timezone filter to output the timezone used by a date object. The output may either be the full timezone identifier or the shortened timezone abbreviation.
Liquid
{{request.date | timezone}}
Output
EST
Liquid
{{request.date | add_months: 6 | timezone}}
Output
EDT
Liquid
{{request.date | timezone: true}}
Output
America/Indiana/Indianapolis

to_timezone filter

Converts a date to the specified timezone.

to_timezone: string timezone
Example Convert or display dates in a timezone (to_timezone filter)Demonstrates multiple ways to use the to_timezone filter.

Display the article post date in multiple timezones

Liquid
{{ article.post_date | to_timezone: session.user_timezone }} local time
{{- article.post_date | to_timezone: 'UTC' }} UTC
{{- article.post_date | to_timezone: 'Europe/Rome' }} CET
Output
2026-02-16 6:00:00 local time
2026-02-16 10:00:00 UTC
2026-02-16 11:00:00 CET

Convert a date to a different timezone and display it with formatting

Liquid
{%- if entity.alt_timezone.is_valid -%}
	{{- entity.alt_date | to_timezone: entity.alt_timezone | date: 'f' }} {{ entity.alt_timezone -}}
{%- endif -%}
Output
2026-02-16 12:00:00
Example How to use the format filter to format datesFormat dates using standard or custom .NET date formats.
Liquid
{% var sep9 = '2009-09-09 14:00:00Z' | date | to_timezone: 'America/New_York' %}

Format a date as a short date string

Liquid
{{sep9 | format: "d"}}
Output
9/9/2009

Formats a date as a short date string (d = short date).

Format a date as a short date string with the time

Liquid
{{sep9 | format: "g"}}
Output
9/9/2009 10:00 AM

Formats a date as a short date string with the time (g = short date with time).

Format a date as a long date string

Liquid
{{sep9 | format: "D"}}
Output
Sunday, September 9, 2009

Formats a date as a long date string (D = long date).

Format a date as a long date string with the time

Liquid
{{sep9 | format: "f"}}
Output
Sunday, September 9, 2009 10:00 AM

Formats a date as a long date string with the time (f = long date with time).

Format a date according to the ISO 8601 standard

Liquid
{{sep9 | format: "o"}}
Output
9/9/2009 2:00:00 PM

Formats a date according to the ISO 8601 standard (o = round trip format with offset).

Format a date as a sortable date string

Liquid
{{sep9 | format: "u"}}
Output
9/9/2009 2:00:00 PM

Formats a date as a sortable date string (u = universal sortable date in UTC timezone).

Format a date to a long date string using a custom date format string

Liquid
{{sep9 | format: "MMMM dd, yyyy 'at' HH:mm:ss"}}
Output
September 09, 2009 at 10:00:00

Formats a date using a custom .NET date format string.

Format a date to a short date string using a custom date format string

Liquid
{{sep9 | format: "hh:mm tt 'on' MM-dd-yy"}}
Output
10:00 AM on 09-09-09

Formats a date using a custom .NET date format string.

You can also use the date filter to format a date

Liquid
{{sep9 | date: "hh:mm tt 'on' MM-dd-yy"}}
Output
10:00 AM on 09-09-09

The date and format filters use the same format strings for dates, but the date filter can only be used to format dates while the format filter can also be used to format numbers and time diffs.

Example Use math to manipulate datesUse the add_seconds, add_minutes, add_hours, add_days, add_weeks, add_months, and add_years filters to manipulate dates.
Liquid
{% var startdate = '2009-09-09T00:00:00Z' | to_timezone: 'UTC' %}

add_seconds

Liquid
{{ startdate | add_seconds: 3 }}
Output
9/9/2009 12:00:03 AM
Liquid
{{ startdate | add_seconds: -10239 }}
Output
9/8/2009 9:09:21 PM

add_minutes

Liquid
{{ startdate | add_minutes: 3 }}
Output
9/9/2009 12:03:00 AM
Liquid
{{ startdate | add_minutes: -180 }}
Output
9/8/2009 9:00:00 PM

add_hours

Liquid
{{ startdate | add_hours: 3 }}
Output
9/9/2009 3:00:00 AM
Liquid
{{ startdate | add_hours: -32 }}
Output
9/7/2009 4:00:00 PM

add_days

Liquid
{{ startdate | add_days: 3 }}
Output
9/12/2009 12:00:00 AM
Liquid
{{ startdate | add_days: -2 }}
Output
9/7/2009 12:00:00 AM

add_weeks

Liquid
{{ startdate | add_weeks: 3 }}
Output
9/30/2009 12:00:00 AM
Liquid
{{ startdate | add_weeks: -7 }}
Output
7/22/2009 12:00:00 AM

add_months

Liquid
{{ startdate | add_months: 3 }}
Output
12/9/2009 12:00:00 AM
Liquid
{{ startdate | add_months: -10 }}
Output
11/9/2008 12:00:00 AM

add_years

Liquid
{{ startdate | add_years: 3 }}
Output
9/9/2012 12:00:00 AM
Liquid
{{ startdate | add_years: -1 }}
Output
9/9/2008 12:00:00 AM