addSeconds()function

addSeconds(change: number, target?: PossibleDate, caller: AnyCaller = addSeconds): Date
ParamType
changenumber
The number of seconds to add (negative numbers subtract). required
targetPossibleDate
Any value that can be converted to a date (defaults to "now").
callerAnyCaller
Function to attribute a thrown error to (defaults to addSeconds itself). Defaults to addSeconds
Return
Date
A new Date instance offset by change seconds.
Throws
RequiredError
If target couldn't be converted to a valid date.

Return a new date that increases or decreases the seconds based on an input date.

Examples

addSeconds(30, "2003-09-12T00:00:00") // Date instance for 2003-09-12T00:00:30