addSeconds(datetime, seconds) Last updated: 04. Mar 2025
Adding a number of days (positive or negative value) to a specified date.
Parameters
| Name | Type | Description | 
|---|---|---|
| datetime | Datetime object | Date and time on which to add seconds to. | 
| seconds | number (int or float) | How many seconds to add to specified datetime. | 
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 and time object
    var after = docly.addSeconds(before, 33); // Add seconds
}#
<b>Before:</b> #format(before, "HH:mm:ss")#
<b>After:</b> #format(after, "HH:mm:ss")#Output
The #JS code above produces the output shown below:<b>Before:</b> 02:29:59
<b>After:</b> 02:30:32