date_str

Converts a string timestamp into another date format returned as a string. The format for this syntax is the same as strftime. date_str is nearly the same as piping a string to str_to_date then piping the value to date.

Input

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

Output

Fri, Jul 17, 15

Input

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

Output

2015

date_str works on unix timestamps.

Input

{{'980989200' | date_str: '%Y-%m-%d %H:%M' }}

Output

2001-02-01 01:00

Input

{{'1706201489' | date_str: '%Y-%m-%d %H:%M' }}

Output

2024-01-25 16:51

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 2023-07-07 14:07.

Note that the value will be the current time of when the page was last generated from the template, not when the page is presented to a user if caching or static site generation is involved.

Last updated