| 1 |
--- |
| 2 |
title: Add |
| 3 |
description: Returns the given time plus the given duration. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: time.Time |
| 9 |
signatures: [TIME.Add DURATION] |
| 10 |
--- |
| 11 |
|
| 12 |
```go-html-template |
| 13 |
{{ $t := time.AsTime "2023-01-27T23:44:58-08:00" }} |
| 14 |
|
| 15 |
{{ $d1 = time.ParseDuration "3h20m10s" }} |
| 16 |
{{ $d2 = time.ParseDuration "-3h20m10s" }} |
| 17 |
|
| 18 |
{{ $t.Add $d1 }} → 2023-01-28 03:05:08 -0800 PST |
| 19 |
{{ $t.Add $d2 }} → 2023-01-27 20:24:48 -0800 PST |
| 20 |
``` |