github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/timestamp.html.md (about)

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