github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/timestamp.mdx (about) 1 --- 2 page_title: timestamp - Functions - Configuration Language 3 description: |- 4 The timestamp function returns a string representation of the current date 5 and time. 6 --- 7 8 # `timestamp` Function 9 10 `timestamp` returns a UTC timestamp string in [RFC 3339](https://tools.ietf.org/html/rfc3339) format. 11 12 In the Terraform language, timestamps are conventionally represented as 13 strings using [RFC 3339](https://tools.ietf.org/html/rfc3339) 14 "Date and Time format" syntax, and so `timestamp` returns a string 15 in this format. 16 17 The result of this function will change every second, so using this function 18 directly with resource attributes will cause a diff to be detected on every 19 Terraform run. We do not recommend using this function in resource attributes, 20 but in rare cases it can be used in conjunction with 21 [the `ignore_changes` lifecycle meta-argument](/language/meta-arguments/lifecycle#ignore_changes) 22 to take the timestamp only on initial creation of the resource. For more stable 23 time handling, see the [Time Provider](https://registry.terraform.io/providers/hashicorp/time/). 24 25 Due to the constantly changing return value, the result of this function cannot 26 be predicted during Terraform's planning phase, and so the timestamp will be 27 taken only once the plan is being applied. 28 29 ## Examples 30 31 ``` 32 > timestamp() 33 2018-05-13T07:44:12Z 34 ``` 35 36 ## Related Functions 37 38 * [`formatdate`](/language/functions/formatdate) can convert the resulting timestamp to 39 other date and time formats.