mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-02 19:52:38 +00:00
971 B
971 B
title, description, categories, keywords, params, aliases
| title | description | categories | keywords | params | aliases | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| time.Duration | Returns a time.Duration value using the given time unit and number. |
|
|
The time.Duration function returns a time.Duration value that you can use with any of the Duration methods.
This template:
{{ $duration := time.Duration "hour" 24 }}
{{ printf "There are %.0f seconds in one day." $duration.Seconds }}
Is rendered to:
There are 86400 seconds in one day.
The time unit must be one of the following:
| Duration | Valid time units |
|---|---|
| hours | hour, h |
| minutes | minute, m |
| seconds | second, s |
| milliseconds | millisecond, ms |
| microseconds | microsecond, us, µs |
| nanoseconds | nanosecond, ns |