Debian Codegraph @

docs/content/en/methods/duration/Truncate.md

raw
1 ---
2 title: Truncate
3 description: Returns the result of rounding DURATION1 toward zero to a multiple of DURATION2.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: time.Duration
9 signatures: [DURATION1.Truncate DURATION2]
10 ---
11
12 ```go-html-template
13 {{ $d = time.ParseDuration "3.5h2.5m1.5s" }}
14
15 {{ $d.Truncate (time.ParseDuration "2h") }} → 2h0m0s
16 {{ $d.Truncate (time.ParseDuration "3m") }} → 3h30m0s
17 {{ $d.Truncate (time.ParseDuration "4s") }} → 3h32m28s
18 ```