Examples using... time.ParseDuration()
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".
Truncate returns the result of rounding d toward zero to a multiple of m. If m <= 0, Truncate returns d unchanged.
Seconds returns the duration as a floating point number of seconds.
Round returns the result of rounding d to the nearest multiple of m. The rounding behavior for halfway values is to round away from zero. If the result exceeds the maximum (or minimum) value that can be stored in a Duration, Round returns the maximum (or minimum) duration. If m <= 0, Round returns d...
Nanoseconds returns the duration as an integer nanosecond count.
Minutes returns the duration as a floating point number of minutes.
Hours returns the duration as a floating point number of hours.
The following forms are permitted: