Dateadd function allows to add the specified number of years, months, days, hours, minutes and seconds to the specified date.
This is how it looks like:
=dateadd([start_date], [what_to_add])
In [start_date] section, you can use variables, template parameters or element fields. Also, you can enter any date manually or set the current time and date using {=System:Now}.
To set the desired time unit (years, months, days, hours, minutes or seconds), you can use the corresponding values in [what_to_add] section: y, m, d, h, i, s. Use + and - signs to add or subtract the specified value from the 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.
Use case
One of the most popular examples of using dateadd function is to create a task and automatically calculate its deadline 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 action in your business process and insert =dateadd({=System:Now}, "+10d") in the Deadline field.
After initializing this business process, a task will be created. Its deadline will be 10 days later than the creation date.
{{=dateadd({=Document:DATE_CREATE}, "+1d")}}
Read also: