AddSeconds(datetime, seconds) Last updated: 21. Dec 2022

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


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.


A modified date, does not modify input date.


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")#


The #JS code above produces the output shown below:
<b>Before:</b> 13:22:02
<b>After:</b> 13:22:35