Document how to get the current time

This commit is contained in:
Akinori MUSHA
2016-10-22 11:19:50 +09:00
parent 8b07f4b059
commit 0ecaecc889

View File

@@ -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`:
<p class="code-label">Input</p>
```liquid
{% raw %}
This page was last updated at {{ "now" | date: "%Y-%m-%d %H:%M" }}.
{% endraw %}
```
<p class="code-label">Output</p>
```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.