This task creates a Duration variable to be used with a DateTime variable.
Use it whenever a ruleset needs to shift a date/time value forward or backward — for example, calculating a payment due date 30 days from an invoice date, flagging documents that are more than 24 hours old, adding a processing buffer before a scheduled retry, or setting an expiration date some number of months in the future. CreateDuration builds the offset; you'd then typically apply it against a DateTime variable (e.g., using a date-arithmetic action) to get the resulting date/time.
Properties:
| Property | Type | Description |
|---|---|---|
| IsNegative | Boolean | Determines whether the duration applies to the future (true) or the past (false). |
| Years | Number | Number of years. |
| Months | Number | Number of months. |
| Days | Number | Number of days. |
| Hours | Number | Number of hours. |
| Minutes | Number | Number of minutes. |
| Seconds | Number | Number of seconds. |
| Milliseconds | Number | Number of milliseconds. |
Behavior notes:
- Negative numeric values are not allowed and will throw an exception — there's no built-in validation to catch this beforehand, so check inputs upstream if they come from a variable.
- At least one value must be supplied; an entirely empty duration throws an exception.
-
0is valid in any field (e.g., a duration of all zeros is fine). - Any non-negative number is accepted in each field.
- If
IsNegativeisn't explicitlytrue(or a Boolean variable evaluating totrue), it defaults tofalse— meaning the duration is treated as pointing to the future unless you say otherwise.
Example: To represent "45 days from now," you'd set:
- IsNegative:
false - Days:
45 - (all other fields:
0)
To represent "3 days ago," you'd set:
- IsNegative:
true - Days:
3
See also: CreateList for building structured collections; Ruleset Actions M - T for date/time actions that likely consume a Duration (e.g., adding it to a DateTime).
Comments
0 comments
Please sign in to leave a comment.