Unlike the getTime task (which provides a current system timestamp), the addDuration task adds a specified duration to an existing timestamp and returns the adjusted result for continued use in the automation.
If a date value is provided in a record, use addDuration to determine what the timestamp would be after adding additional time. For example, adding six months to a poll record could generate a result such as: “Last poll occurred on Jan 1; next poll will occur on Jun 1.”
When using object literal notation in offsetDuration, you must include the curly braces. Numeric values entered without any other designators are treated as milliseconds by default. See the moment.js documentation for more information.
The newTime object inherits the same format as inputTime. The addDuration task does not provide a mechanism to change the time format.
In this example:
inputTime comes from the Get time task with reference variable time.offsetDuration adds four days using object literal notation: {"days": 4}.inputTime is "2020-06-01", the resulting newTime is "2020-06-05".
In this example:
inputTime comes from the Get time task with reference variable time.offsetDuration is 86400000 milliseconds (24 hours), entered as a plain numeric value without object literal notation.newTime is the inputTime plus 24 hours.
In this example:
inputTime comes from the Get time task with reference variable time.offsetDuration adds four hours and six months using object literal notation: {"hours": 4, "months": 6}.newTime is the inputTime plus six months and four hours.
To enter the inputTime object manually, use Year-Month-Date-Time format ("yyyy-MM-dd'T'HH:mm:ss.SSSZ"):
This displays as: