Bitrix24Care

Dateadd function

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.

Dateadd function does note change the date specified in [start_date] section. If you use the creation date of an item, this date won't be modified. The function uses it and adds the value specified in [what_to_add] section. To save the resulting date value, you need to insert it in a separate field or variable.

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.

To use the resulting date as text in notifications, tasks or Feed posts, the function must be enclosed in curly brackets:

{{=dateadd({=Document:DATE_CREATE}, "+1d")}}


Read also:
Was this information helpful?
Integration specialist assistance
That's not what I'm looking for
Complicated and incomprehensible text
The information is outdated
It's too short. I need more information
I don't like the way this tool works
Go to Bitrix24
Don't have an account? Create for free