shithub: hugo

Download patch

ref: b33bfd40bed7af36faba18bed09efb6b95c58192
parent: f2faae08050fa78d370f0f3e137567566f2e7392
author: Wade Fitzpatrick <[email protected]>
date: Mon Aug 8 07:38:18 EDT 2016

docs: Add doc for time template func

--- a/docs/content/templates/functions.md
+++ b/docs/content/templates/functions.md
@@ -741,6 +741,16 @@
 ```
 
 
+## 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