Date.prototype.setMinutes() changes the minutes of an existing Date in local time. It can optionally set seconds and milliseconds at the same time, normalizes values outside 0–59, mutates the Date, and returns the updated timestamp.
Syntax:
date.setMinutes(minutes);
date.setMinutes(minutes, seconds, milliseconds);
A basic example:
const date = new Date(2026, 8, 10, 14, 5);
date.setMinutes(15);
console.log(date.getMinutes()); // 15
The original example set the minute field to a fixed value. That remains the simplest use:
const date = new Date();
date.setMinutes(20);
console.log(date.toTimeString());
const date = new Date();
date.setMinutes(30, 45, 250);
console.log(date);
Values above 59 carry into the next hour. Negative values move into an earlier hour. The original -75 example is a useful demonstration of this normalization.
const date = new Date(2026, 8, 10, 12, 0);
date.setMinutes(-75);
console.log(date.toString()); // rolls back 1 hour 15 minutes
const date = new Date(2026, 8, 10, 23, 30);
date.setMinutes(90);
console.log(date); // carries into the next day
const date = new Date();
date.setMinutes(date.getMinutes() + 45);
console.log(date);
For exact elapsed-duration arithmetic, adding milliseconds to getTime() is another option.
const date = new Date();
const timestamp = date.setMinutes(10);
console.log(typeof timestamp); // "number"
const date = new Date();
date.setUTCMinutes(0, 0, 0);
console.log(date.toISOString());
NaN, which makes the Date invalid.Next: Date toString() Date Reference
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.