date

Converts a timestamp into another date format using strftime syntax.

Note

The time filter is recommended to be used instead of date it is more versatile and correctly applies timezone and DST to the formatted output.

Input

{{ article.published_at | date: "%a, %b %d, %y" }}

Output

Fri, Jul 17, 15

Input

{{ article.published_at | date: "%Y" }}

Output

2015

date works on strings if they contain well-formatted dates:

Input

{{ "March 14, 2016" | date: "%b %d, %y" }}

Output

Mar 14, 16

To get the current time, pass the special word "now" (or "today") to date:

Input

This page was last updated at {{ "now" | date: "%Y-%m-%d %H:%M" }}.

Output

This page was last updated at 2020-03-25 15:57.
PDF HTML Epub Powered by Read The Docs