Gopher

time

Time is Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

time.AsTime  

(v any, args …any) → any

AsTime converts the textual representation of the datetime string into a time.Time interface.

Examples

{{ (time "2015-01-21").Year }}
2015

time.Duration  

(unit any, number any) → Duration

Duration converts the given number to a time.Duration. Unit is one of nanosecond/ns, microsecond/us/µs, millisecond/ms, second/s, minute/m or hour/h.

Aliases: duration

Examples

{{ mul 60 60 | duration "second" }}
1h0m0s

time.Format  

(layout string, v any) → string

Format converts the textual representation of the datetime string into the other form or returns it of the time.Time value. These are formatted with the layout string

Aliases: dateFormat

Examples

dateFormat: {{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }}
dateFormat: Wednesday, Jan 21, 2015

time.Now  

() → time.Time

Now returns the current local time.

Aliases: now

time.ParseDuration  

(in any) → Duration

ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”. See https://golang.org/pkg/time/#ParseDuration

Examples

{{ "1h12m10s" | time.ParseDuration }}
1h12m10s