date

Filters = date

Converts a timestamp into another date format. The format for this syntax is the same as strftime. The input uses the same format as Ruby’s Time.parse.

INPUT

OUTPUT

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

Fri, Jul 17, 15

INPUT

OUPUT

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

2015

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

INPUT

OUTPUT

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

Mar 14, 16

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

INPUT

OUTPUT

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

This page was last updated at 2019-09-19 17:48.

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.