> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/6/studio/tasks/reference/add-duration-time/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # addDuration > Use the addDuration task to add a duration to an existing timestamp and return the adjusted time. 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. ## Potential use case 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."* ## Properties ### Input variables | Incoming | Type | Description | Example | | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- | | `inputTime` | Object | Required. A timestamp from a previous task. Must contain `time` (a string representation of the time) and `formatString` (the [moment.js format](https://momentjs.com/docs/#/displaying/format/) the time must adhere to). | `{ "time": "2023-04-28T01:21:14.052000-1100", "formatString": "YYYY-MM-DDTHH:mm:ss.SSSSSSZZ" }` | | `offsetDuration` | Object | Required. A duration expressed as object literal notation (e.g., `{"days": 7, "months": 1}`) or as a plain numeric millisecond value. | `{"days": 7, "months": 1}` / `{"hours": 4}` / `31556926000` | 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](https://momentjs.com/docs/#/displaying/format/) for more information. ### Output variables | Outgoing | Type | Description | | :-------- | :----- | :----------------------------------------------------------------------------------------------------- | | `newTime` | Object | The new time after adding the given duration to `inputTime`. The format is inherited from `inputTime`. | The `newTime` object inherits the same format as `inputTime`. The `addDuration` task does not provide a mechanism to change the time format. ## Example 1 In this example: * `inputTime` comes from the `Get time` task with reference variable `time`. * `offsetDuration` adds four days using object literal notation: `{"days": 4}`. * If `inputTime` is `"2020-06-01"`, the resulting `newTime` is `"2020-06-05"`. ![](/_fern-img/7afb50b071e58257522b6cf231af99b1f216259ba63be4cbca4130f48a718698.webp) ## Example 2 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. * The resulting `newTime` is the `inputTime` plus 24 hours. ![](/_fern-img/75153c1fdc38487fc9b66a275b884195b4c4863920f0df6209e682aded289458.webp) ## Example 3 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}`. * The resulting `newTime` is the `inputTime` plus six months and four hours. ![](/_fern-img/f6a3b81acbac3495091319a9c7f6d06cc0b2d255edd5d304b3b45693967bf2f7.webp) ## Manual reference variable entry (inputTime) To enter the `inputTime` object manually, use Year-Month-Date-Time format (`"yyyy-MM-dd'T'HH:mm:ss.SSSZ"`): ```json {"time": "2021-02-26T15:00:00.000Z"} ``` This displays as: ``` 2021-02-25 03:00.00 ``` ## Related reading * [addDuration API](https://apidocs.itential.com/api/app-workflow_engine/addDuration/) * [getTime API](https://apidocs.itential.com/api/app-workflow_engine/getTime/) > Use the addDuration task to add a duration to an existing timestamp and return the adjusted time.