commit b33bfd40bed7af36faba18bed09efb6b95c58192
parent f2faae08050fa78d370f0f3e137567566f2e7392
Author: Wade Fitzpatrick <wade.fitzpatrick@gmail.com>
Date: Mon, 8 Aug 2016 11:38:18 +1000
docs: Add doc for time template func
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git 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