timeadd function reference
This topic provices reference information about the timeadd
function.
timeadd
adds a duration to a timestamp, returning a new timestamp.
Introduction
The Terraform language represents timestamps as strings using RFC
3339's Date and Time format.
timeadd
requires that the timestamp
argument is a string conforming to the Date and Time syntax.
Syntax
Use the timeadd
function with the following syntax:
timestamp
is a string representation of a date in RFC 3339 format. Refer to the external RFC 3339's Internet Date/Time Format section for how to construct a timestamp string.duration
is a string representation of a time difference. This string consists of sequences of number and unit pairs, such as"1.5h"
or"1h30m"
. You may use the following units:
The timeadd
result is a string, also in RFC 3339 format, representing the result
of adding the given duration to the given timestamp.
Example use case
This example adds ten minutes.
This example subtracts ten minutes by using a negative duration.
Related Functions
timecmp
determines an ordering for two timestamps.