From 0ecaecc889137f42b970aba710c535448396a2fa Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Sat, 22 Oct 2016 11:19:50 +0900 Subject: [PATCH] Document how to get the current time --- filters/date.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/filters/date.md b/filters/date.md index c63807d..09f67f1 100644 --- a/filters/date.md +++ b/filters/date.md @@ -41,3 +41,19 @@ Fri, Jul 17, 15 ```text {{ "March 14, 2016" | date: "%b %d, %y" }} ``` + +To get the current time, pass the special word `"now"` (or `"today"`) to `date`: + +

Input

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

Output

+```text +This page was last updated at {{ "now" | date: "%Y-%m-%d %H:%M" }}. +``` + +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.