There's a setSeconds method as well:

var t = new Date();
t.setSeconds(t.getSeconds() + 10);

For a list of the other Date functions, you should check out MDN


setSeconds will correctly handle wrap-around cases:

var d;
d = new Date('2014-01-01 10:11:55');
alert(d.getMinutes() + ':' + d.getSeconds()); //11:55
d.setSeconds(d.getSeconds() + 10);
alert(d.getMinutes() + ':0' + d.getSeconds()); //12:05

Answer from zzzzBov on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-adding-seconds-to-date-object
JavaScript Adding seconds to Date object - GeeksforGeeks
July 11, 2025 - We will use a few methods to add seconds to the date, that are discussed below: JavaScript getSeconds() Method: This method returns the Seconds(from 0 to 59) of the provided date and time.
🌐
W3Schools
w3schools.com › jsref › jsref_setseconds.asp
JavaScript Date setSeconds() Method
cssText getPropertyPriority() getPropertyValue() item() length parentRule removeProperty() setProperty() JS Conversion · ❮ Previous JavaScript Date Reference Next ❯ · Set the seconds to 35: const d = new Date("2025-01-15"); d.setSeconds(35); Try it Yourself » ·
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › setSeconds
Date.prototype.setSeconds() - JavaScript | MDN
The setSeconds() method of Date instances changes the seconds and/or milliseconds for this date according to local time. const event = new Date("August 19, 1975 23:15:30"); event.setSeconds(42); console.log(event.getSeconds()); // Expected output: 42 console.log(event); // Expected output: ...
🌐
Futurestud.io
futurestud.io › tutorials › add-seconds-to-a-date-in-node-js-and-javascript
Add Seconds to a Date in Node.js and JavaScript
First, create a new date representing “now”. Then, replace the seconds of the “now” date by adding the delay to the current time:
🌐
30 Seconds of Code
30secondsofcode.org › home › javascript › date › add minutes, hours or days to date
How can I add minutes, hours or days to a JavaScript date? - 30 seconds of code
January 5, 2024 - All values are in milliseconds, so we'll have to multiply the number of seconds by 1000 before setting the time. Note, however, that setting the time mutates the object, so we'll also have to create a new Date object to avoid mutating the original. ...
🌐
Attacomsian
attacomsian.com › blog › javascript-date-add-seconds
How to add seconds to a date in JavaScript
September 10, 2022 - Use the getSeconds() method to get the seconds of the given date. Use the setSeconds() method by passing the result returned by getSeconds() plus the number of seconds you want to add.
🌐
JavaScript in Plain English
javascript.plainenglish.io › javascript-date-add-seconds-df0d9091221
Add Seconds to a Date in JavaScript | JavaScript in Plain English
September 4, 2024 - To add seconds to a date in JavaScript, use the getSeconds() method to get the seconds, then call the setSeconds() method on the date, passing as arguments the sum of getSeconds() and the number of seconds to add.
🌐
TutorialsPoint
tutorialspoint.com › How-to-add-10-seconds-to-a-JavaScript-date-object
How to add 10 seconds to a JavaScript date object?
<html> <head> <title>Example- adding 10 seconds to a JavaScript date object</title> </head> <body> <h3> Add 10 seconds to the JavaScript Date object using setSeconds( ) method </h3> <p> Click on the button to add 10 seconds to the current date/time.</p> <button onclick="add()">Click Me</button> ...
Find elsewhere
🌐
Envato Tuts+
webdesign.tutsplus.com › home › web design › html/css › javascript for designers
How to Add and Subtract Time From a Date in JavaScript | Envato Tuts+
September 19, 2023 - Basically, we’ve just multiplied the number of minutes in an hour (60) by the number of seconds in a minute (60) by the number of milliseconds in a second (1000) to get the number of milliseconds in an hour. As you might already know, you can initialize a Date object by providing the number of milliseconds as the first argument, and this would initialize a date object in reference to it. Thus, we’ve added numberOfMlSeconds and addMlSeconds to get the total number of milliseconds, and we’ve used it to initialize a new date object.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › setHours
Date.prototype.setHours() - JavaScript | MDN
The setHours() method of Date instances changes the hours, minutes, seconds, and/or milliseconds for this date according to local time. const event = new Date("August 19, 1975 23:15:30"); event.setHours(20); console.log(event); // Expected output: "Tue Aug 19 1975 20:15:30 GMT+0200 (CEST)" ...
🌐
Coding Beauty
codingbeautydev.com › home › posts › how to add seconds to a date in javascript
How to Add Seconds to a Date in JavaScript - Coding Beauty
August 19, 2022 - To add seconds to a date in JavaScript, use the getSeconds() method to get the seconds, then call the setSeconds() method on the date, passing as an argument the sum of getSeconds() and the number of seconds to add.
🌐
W3Schools
w3schools.com › jsref › jsref_getseconds.asp
JavaScript Date getSeconds() Method
cssText getPropertyPriority() ...tSeconds()); let time = h + ":" + m + ":" + s; Try it Yourself » · getSeconds() returns the seconds (0 to 59) of a date....
🌐
GitConnected
levelup.gitconnected.com › javascript-tips-add-seconds-format-dates-traverse-objects-and-more-17d8a673881f
JavaScript Tips — Add Seconds, Format Dates, Traverse Objects, and More | by John Au-Yeung | Level Up Coding
July 13, 2020 - We create a Date instance. Then we call setSeconds to set the seconds. We put the number of seconds from getSeconds plus the number of seconds we want to add.
🌐
GeeksforGeeks
geeksforgeeks.org › node.js › node-js-date-and-time-date-addseconds-method
Node.js date-and-time Date.addSeconds() Method - GeeksforGeeks
March 25, 2021 - // Node.js program to demonstrate the // Date.addSeconds() method // Importing date-and-time module const date = require('date-and-time') // Creating object of current date and time // by using Date() const now = new Date(); now.setDate(20) ...
🌐
Designcise
designcise.com › web › tutorial › how-to-add-seconds-to-a-javascript-date-object
How to Add Seconds to a JavaScript Date Object? - Designcise
July 15, 2021 - Node.js · Daniyal Hamid · 15 Jul, 2021 · 1 min read · To add any number of seconds to an already instantiated Date object, you can simply add them to the seconds from that Date object.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getSeconds
Date.prototype.getSeconds() - JavaScript | MDN
The seconds variable has value 30, based on the value of the Date object xmas95. js · const xmas95 = new Date("1995-12-25T23:15:30"); const seconds = xmas95.getSeconds(); console.log(seconds); // 30 · Date.prototype.getUTCSeconds() Date.prototype.setSeconds() Was this page helpful to you?
🌐
Codecademy
codecademy.com › docs › javascript › dates › .setseconds()
JavaScript | Dates | .setSeconds() | Codecademy
June 21, 2023 - In the example below, the myDate variable is declared and then the .setSeconds() method is applied to return a modified time. const myDate = new Date('August 29, 2022 23:15:30'); ... Learn how to use JavaScript — a powerful and flexible ...
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-date-exercise-6.php
JavaScript: Add minutes to a Date object - w3resource
It achieves this by utilizing the "getTime()" method of the Date object, which returns the number of milliseconds since the Unix epoch (January 1, 1970 00:00:00 UTC) for the given date, and then adding the number of milliseconds corresponding ...
🌐
Day.js
day.js.org › docs › en › manipulate › add
Add · Day.js
result = dayjs().add(dayjs.duration({'days' : 1}))