AddDays(date, days) Last updated: 21. Dec 2022

Adding a number of days (positive or negative value) to a specified date.

Parameters

Name Type Description
date Date and time object Date object on which to add days to.
days number (int or float) How many days to add to specified date.

Returns

A modified date, does not modify input date.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    var before = new Date(); // Create new date object
    var after = docly.AddDays(before, 5.2); // Add 5.2 days
}#
<b>Before:</b> #format(before, "dd. MMM yyyy HH:mm")#<br>
<b>After:</b> #format(after, "dd. MMM yyyy HH:mm")#

Output

The #JS code above produces the output shown below:
<b>Before:</b> 10. Dec 2024 13:58<br>
<b>After:</b> 15. Dec 2024 18:46