From: Wade Fitzpatrick Date: Mon, 8 Aug 2016 01:38:18 +0000 (+1000) Subject: docs: Add doc for time template func X-Git-Tag: v0.17~192 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b33bfd40bed7af36faba18bed09efb6b95c58192;p=brevno-suite%2Fhugo docs: Add doc for time template func --- diff --git a/docs/content/templates/functions.md b/docs/content/templates/functions.md index 9f449938..1df0a80f 100644 --- a/docs/content/templates/functions.md +++ b/docs/content/templates/functions.md @@ -741,6 +741,16 @@ This can be useful if you want to use Gravatar for generating a unique avatar: ``` +## Times + +### time + +`time` converts a timestamp string into a [`time.Time`](https://godoc.org/time#Time) structure so you can access its fields. E.g. + +* `{{ time "2016-05-28" }}` → "2016-05-28T00:00:00Z" +* `{{ (time "2016-05-28").YearDay }}` → 149 +* `{{ mul 1000 (time "2016-05-28T10:30:00.00+10:00").Unix }}` → 1464395400000 (Unix time in milliseconds) + ## URLs