Using a Library

If you are doing a lot of date work, you may want to look into JavaScript date libraries like Luxon, Day.js, or Moment.js. For example, with Moment.js, this is simply:

var newDateObj = moment(oldDateObj).add(30, 'm').toDate();

Vanilla Javascript

This is like chaos's answer, but in one line:

var newDateObj = new Date(oldDateObj.getTime() + diff*60000);

Where diff is the difference in minutes you want from oldDateObj's time. It can even be negative.

Or as a reusable function, if you need to do this in multiple places:

function addMinutes(date, minutes) {
    return new Date(date.getTime() + minutes*60000);
}

And just in case this is not obvious, the reason we multiply minutes by 60000 is to convert minutes to milliseconds.

Be Careful with Vanilla Javascript. Dates Are Hard!

You may think you can add 24 hours to a date to get tomorrow's date, right? Wrong!

addMinutes(myDate, 60*24); //DO NOT DO THIS

It turns out, if the user observes daylight saving time, a day is not necessarily 24 hours long. There is one day a year that is only 23 hours long, and one day a year that is 25 hours long. For example, in most of the United States and Canada, 24 hours after midnight, Nov 2, 2014, is still Nov 2:

const NOV = 10; //because JS months are off by one...
addMinutes(new Date(2014, NOV, 2), 60*24); //In USA, prints 11pm on Nov 2, not 12am Nov 3!

This is why using one of the afore-mentioned libraries is a safer bet if you have to do a lot of work with this.

Below is a more generic version of this function that I wrote. I'd still recommend using a library, but that may be overkill/impossible for your project. The syntax is modeled after MySQL DATE_ADD function.

/**
 * Adds time to a date. Modelled after MySQL DATE_ADD function.
 * Example: dateAdd(new Date(), 'minute', 30)  //returns 30 minutes from now.
 * https://stackoverflow.com/a/1214753/18511
 * 
 * @param date  Date to start with
 * @param interval  One of: year, quarter, month, week, day, hour, minute, second
 * @param units  Number of units of the given interval to add.
 */
function dateAdd(date, interval, units) {
  if(!(date instanceof Date))
    return undefined;
  var ret = new Date(date); //don't change original date
  var checkRollover = function() { if(ret.getDate() != date.getDate()) ret.setDate(0);};
  switch(String(interval).toLowerCase()) {
    case 'year'   :  ret.setFullYear(ret.getFullYear() + units); checkRollover();  break;
    case 'quarter':  ret.setMonth(ret.getMonth() + 3*units); checkRollover();  break;
    case 'month'  :  ret.setMonth(ret.getMonth() + units); checkRollover();  break;
    case 'week'   :  ret.setDate(ret.getDate() + 7*units);  break;
    case 'day'    :  ret.setDate(ret.getDate() + units);  break;
    case 'hour'   :  ret.setTime(ret.getTime() + units*3600000);  break;
    case 'minute' :  ret.setTime(ret.getTime() + units*60000);  break;
    case 'second' :  ret.setTime(ret.getTime() + units*1000);  break;
    default       :  ret = undefined;  break;
  }
  return ret;
}

Working jsFiddle demo.

Answer from Kip on Stack Overflow
🌐
W3Schools
w3schools.com › js › js_date_methods.asp
JavaScript Date Methods
The syntax is always Date.now(). UTC methods use UTC time (Coordinated Universal Time). UTC time is the same as GMT (Greenwich Mean Time). The difference between Local time and UTC time can be up to 24 hours. Local Time? UTC Time? The getTimezoneOffset() method returns the difference (in minutes) between local time an UTC time: let diff = d.getTimezoneOffset(); Try it Yourself » · JavaScript Date Tutorial ·
Top answer
1 of 16
1366

Using a Library

If you are doing a lot of date work, you may want to look into JavaScript date libraries like Luxon, Day.js, or Moment.js. For example, with Moment.js, this is simply:

var newDateObj = moment(oldDateObj).add(30, 'm').toDate();

Vanilla Javascript

This is like chaos's answer, but in one line:

var newDateObj = new Date(oldDateObj.getTime() + diff*60000);

Where diff is the difference in minutes you want from oldDateObj's time. It can even be negative.

Or as a reusable function, if you need to do this in multiple places:

function addMinutes(date, minutes) {
    return new Date(date.getTime() + minutes*60000);
}

And just in case this is not obvious, the reason we multiply minutes by 60000 is to convert minutes to milliseconds.

Be Careful with Vanilla Javascript. Dates Are Hard!

You may think you can add 24 hours to a date to get tomorrow's date, right? Wrong!

addMinutes(myDate, 60*24); //DO NOT DO THIS

It turns out, if the user observes daylight saving time, a day is not necessarily 24 hours long. There is one day a year that is only 23 hours long, and one day a year that is 25 hours long. For example, in most of the United States and Canada, 24 hours after midnight, Nov 2, 2014, is still Nov 2:

const NOV = 10; //because JS months are off by one...
addMinutes(new Date(2014, NOV, 2), 60*24); //In USA, prints 11pm on Nov 2, not 12am Nov 3!

This is why using one of the afore-mentioned libraries is a safer bet if you have to do a lot of work with this.

Below is a more generic version of this function that I wrote. I'd still recommend using a library, but that may be overkill/impossible for your project. The syntax is modeled after MySQL DATE_ADD function.

/**
 * Adds time to a date. Modelled after MySQL DATE_ADD function.
 * Example: dateAdd(new Date(), 'minute', 30)  //returns 30 minutes from now.
 * https://stackoverflow.com/a/1214753/18511
 * 
 * @param date  Date to start with
 * @param interval  One of: year, quarter, month, week, day, hour, minute, second
 * @param units  Number of units of the given interval to add.
 */
function dateAdd(date, interval, units) {
  if(!(date instanceof Date))
    return undefined;
  var ret = new Date(date); //don't change original date
  var checkRollover = function() { if(ret.getDate() != date.getDate()) ret.setDate(0);};
  switch(String(interval).toLowerCase()) {
    case 'year'   :  ret.setFullYear(ret.getFullYear() + units); checkRollover();  break;
    case 'quarter':  ret.setMonth(ret.getMonth() + 3*units); checkRollover();  break;
    case 'month'  :  ret.setMonth(ret.getMonth() + units); checkRollover();  break;
    case 'week'   :  ret.setDate(ret.getDate() + 7*units);  break;
    case 'day'    :  ret.setDate(ret.getDate() + units);  break;
    case 'hour'   :  ret.setTime(ret.getTime() + units*3600000);  break;
    case 'minute' :  ret.setTime(ret.getTime() + units*60000);  break;
    case 'second' :  ret.setTime(ret.getTime() + units*1000);  break;
    default       :  ret = undefined;  break;
  }
  return ret;
}

Working jsFiddle demo.

2 of 16
373
var d1 = new Date (),
    d2 = new Date ( d1 );
d2.setMinutes ( d1.getMinutes() + 30 );
alert ( d2 );
🌐
Moment.js
momentjs.com › docs
Moment.js | Docs
Get + Set Millisecond Second Minute Hour Date of Month Day of Week Day of Week (Locale Aware) ISO Day of Week Day of Year Week of Year Week of Year (ISO) Month Quarter Year Week Year Week Year (ISO) Weeks In Year Weeks In Year (ISO) Get Set Maximum Minimum · Manipulate Add Subtract Start of Time End of Time Maximum Minimum Local UTC UTC offset Time zone Offset
🌐
DigitalOcean
digitalocean.com › community › tutorials › easier-datetime-in-laravel-and-php-with-carbon
How To Manage DateTime with Carbon in Laravel and PHP | DigitalOcean
1 week ago - Laravel integrates Carbon automatically: Eloquent model date attributes are returned as Carbon instances when you use $casts or $dates, which means you can call Carbon methods directly on fields like created_at. Mutability and CarbonImmutable matter: The default Carbon class is mutable, so methods like addDays modify the instance in place, while CarbonImmutable always returns a new instance and keeps the original unchanged.
🌐
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 - const addSecondsToDate = (date, ... to seconds, we can add minutes to a date by multiplying the number of milliseconds in a minute (1000 * 60) before setting the time....
🌐
W3Resource
w3resource.com › javascript-exercises › javascript-date-exercise-6.php
JavaScript: Add minutes to a Date object - w3resource
July 17, 2025 - Write a JavaScript function that adds a specified number of minutes to a given Date object using setMinutes().
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-adding-minutes-to-date-object
JavaScript Adding minutes to Date object - GeeksforGeeks
July 11, 2025 - To add minutes to the date object, some methods are used which are listed below: JavaScript getMinutes() Method: This method returns the Minutes (from 0 to 59) of the provided date and time.
Find elsewhere
🌐
Attacomsian
attacomsian.com › blog › javascript-date-add-minutes
How to add minutes to a date in JavaScript
September 10, 2022 - Use the getMinutes() method to get the minutes of the given date. Use the setMinutes() method by passing the result returned by getMinutes() plus the number of minutes you want to add.
🌐
TutorialsPoint
tutorialspoint.com › how-to-add-30-minutes-to-a-javascript-date-object
How to add 30 minutes to a JavaScript Date object?
August 22, 2022 - <html> <head> <title>Example- add 30 minutes to Date Object</title> </head> <body> <h2> Add 30 minutes to the JavaScript Date object using getTime( ) method </h2> <p> Click on the button to add 30 minutes to the current date/time.</p> <button onclick="add()">Click Me</button> <p id="curren...
🌐
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 - Next, we’ve used the getTime() function to get the number of milliseconds from the currentDateObj object. Next, we’ve calculated the number of milliseconds in an hour. Basically, we’ve just multiplied the number of minutes in an hour (60) ...
🌐
Coding Beauty
codingbeautydev.com › home › posts › how to add minutes to a date in javascript
How to Add Minutes to a Date in JavaScript - Coding Beauty
August 14, 2022 - To add minutes to a Date in JavaScript, call the getMinutes() method on the Date to get the minutes, then call the setMinutes() method on the Date, passing the sum of getMinutes() and the minutes to add.
🌐
W3Schools
w3schools.com › JSREF › jsref_setminutes.asp
JavaScript Date setMinutes() Method
❮ Previous JavaScript Date Reference Next ❯ · Set the minutes to 17: const d = new Date("2025-01-15"); d.setMinutes(17); Try it Yourself » · setMinutes() sets the minutes of a date.
🌐
John hashim
johnhashim.com › posts › how-to-add-or-subtract-minutes-from-a-javascript-date-object
How to add or subtract minutes from a JavaScript Date object – John hashim
August 14, 2020 - This post will show you how to add or subtract minutes based on your projects that involve date objects.
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - - 10 represents the day between 1 to 31. - 23 represents the hour between 1 to 24. - 15 represents the minute. - 34 represents the second. - 0 represent the millisecond. */ const date = new Date(2023, 8, 10, 23, 15, 34, 0); console.log(date);
🌐
Futurestud.io
futurestud.io › tutorials › add-minutes-to-a-date-in-javascript-or-node-js
Add Minutes to a Date in JavaScript or Node.js
JavaScript’s built-in Date type provides useful methods to interact with dates. The two methods that we want to use manipulating minutes are Date#setMinutes and Date#getMinutes. The getMinutes returns the current number of minutes of a given date. And the setMinutes method changes the minutes ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › now
Date.now() - JavaScript | MDN
// This example takes 2 seconds to run const start = Date.now(); console.log("starting timer..."); // Expected output: "starting timer..." setTimeout(() => { const ms = Date.now() - start; console.log(`seconds elapsed = ${Math.floor(ms / 1000)}`); // Expected output: "seconds elapsed = 2" }, 2000);
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
Z is the timezone offset, which can either be the literal character Z (indicating UTC), or + or - followed by HH:mm, the offset in hours and minutes from UTC. Various components can be omitted, so the following are all valid: ... Date-time form: one of the above date-only forms, followed by T, followed by HH:mm, HH:mm:ss, or HH:mm:ss.sss.