class Liquid::Filters::Date

Overview

date Converts a timestamp into another date format. The format for this syntax is the same as strftime.

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

Output Fri, Jul 17, 15

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

Output 2015

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 2016-11-30 13:47.

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.

Extended Modules

Defined in:

liquid/filters/date.cr

Class Method Summary

Class Method Detail

def self.filter(data : Any, arguments : Array(Any) | Nil) : Any #

[View source]