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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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.
{% add_stylesheet %}
{% add_javascript %}
{% add_javascript inline %}
{% add_stylesheet inline %}
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's timezone but may be set explicitly using the {% set_timezone %} method.
Format an entity date field (e.g. date_opened) for display using the date filter.
Format an entity date field with the date filter
CopyYou can use the date filter either to create a date object or to format a date as a string.
Many ways to use the date filter
Copycreate a date object
Defaults to the current date
format a date as a string
Set a date range (e.g. from now to one month ahead) and fetch calendar_entries into the template.
Fetch calendar_entries for the next month using assign and date filters
CopyUse a post_date or other date-time field and format or compare it with the date filter and date properties.
Use a post_date or date-time field with the date filter
CopySet a date range with midnight and add_months, then fetch the next 30 calendar_entries sorted by start_date.
Get Calendar Entries for the Next Month
CopyUse simple date math to get the start and end dates to use for the calendar_entries method, then store the result in the entries variable.
{{ date }}
{{ date_field }}
Return the input as a date at midnight of the same day. That is, with hours, minutes, and seconds set to 0.
midnight
Use the midnight filter to get the input as a date at midnight.
Using the midnight filter
CopyIf 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 otherString format
Compute and display a time difference between two dates.
Compute and display a time difference between two dates
Copy{{ time_diff }}
{{ time }}
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: "Europe/Rome"). If full is false (default) or not specified and an abbreviated timezone name is available returns the abbreviated timezone name (eg: "PST" or "PDT").
timezone: Boolean full
Set the request timezone from a string (e.g. IANA zone) so date/time output uses that zone.
Set the request timezone
CopyUse 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.
Using the timezone filter
CopyDemonstrates multiple ways to use the to_timezone filter.
Convert or display dates in a timezone (to_timezone filter)
CopyDisplay the article post date in multiple timezones
Convert a date to a different timezone and display it with formatting
{{ timezone }}
Converts a date to the specified timezone.
to_timezone: String timezone
Demonstrates multiple ways to use the to_timezone filter.
Convert or display dates in a timezone (to_timezone filter)
CopyDisplay the article post date in multiple timezones
Convert a date to a different timezone and display it with formatting
{{ timezone }}
{% set_timezone %}