Function Updated 19 Oct 2026
addSeconds(datetime, seconds)
Adding a number of seconds (positive or negative value) to a specified date and time.
Parameters
datetimedatetimerequiredDate and time on which to add seconds to.
secondsnumberrequiredHow many seconds to add to specified datetime.
Returns
A modified date, does not modify input date.
Example
Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
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 template above produces this output:
<b>Before:</b> 14:05:24
<b>After:</b> 14:05:57