github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/timeadd.html.md (about) 1 --- 2 layout: "functions" 3 page_title: "timeadd - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-datetime-timeadd" 5 description: |- 6 The timeadd function adds a duration to a timestamp, returning a new 7 timestamp. 8 --- 9 10 # `timeadd` Function 11 12 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 13 earlier, see 14 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 15 16 `timeadd` adds a duration to a timestamp, returning a new timestamp. 17 18 ```hcl 19 timeadd(timestamp, duration) 20 ``` 21 22 In the Terraform language, timestamps are conventionally represented as 23 strings using [RFC 3339](https://tools.ietf.org/html/rfc3339) 24 "Date and Time format" syntax. `timeadd` requires the `timestamp` argument 25 to be a string conforming to this syntax. 26 27 `duration` is a string representation of a time difference, consisting of 28 sequences of number and unit pairs, like `"1.5h"` or `"1h30m"`. The accepted 29 units are `"ns"`, `"us"` (or `"µs"`), `"ms"`, `"s"`, `"m"`, and `"h"`. The first 30 number may be negative to indicate a negative duration, like `"-2h5m"`. 31 32 The result is a string, also in RFC 3339 format, representing the result 33 of adding the given direction to the given timestamp. 34 35 ## Examples 36 37 ``` 38 > timeadd("2017-11-22T00:00:00Z", "10m") 39 2017-11-22T00:10:00Z 40 ```