The dateadd function allows you to add a certain number of years, months, days, hours, minutes, and seconds to the specified date.
This is how it looks:
=dateadd([start_date], [what_to_add])
In the [start_date] section, you can use variables, template parameters, or entity fields. Also, you can enter any date manually or set the current time and date using {=System:Now}.
In the [what_to_add] section, set the desired time unit using the corresponding values:
Unit | Value |
---|---|
Year | y |
Month | m |
Day | d |
Hour | h |
Minute | i |
Second | s |
Use + and - signs to add or subtract the specified value from [start_date]. For example:
=dateadd({=Document:DATE_CREATE}, "+1d"): The resulting date will be 1 day later than the document creation date.
=dateadd({=Document:DATE_CREATE}, "-21d"): The resulting date will be 21 days earlier than the document creation date.
Learn how to insert values using special macros
Use case
The function is commonly used to automatically calculate the deadline for a task based on its creation date. Let's consider the following example and create a task that needs to be done in 10 days.
-
Add the Create task activity to your workflow.
-
Insert =dateadd({=System:Now}, "+10d") in the Deadline field.
-
Run your workflow to create a task. The deadline will be set 10 days after the creation date.
{{=dateadd({=Document:DATE_CREATE}, "+1d")}}