JavaScript Date setMinutes() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.setMinutes() changes the minutes (and optionally seconds and milliseconds) of a date in local time. It mutates the Date in place and returns the new timestamp.

Remember
date.setMinutes(minutes)
date.setMinutes(minutes, seconds)
date.setMinutes(minutes, seconds, ms)

minutes: 0 … 59   (local)
→ returns new timestamp (ms)
→ mutates date

setMinutes(45)           // keep seconds/ms
setMinutes(45, 0, 0)     // snap to :45:00.000
setMinutes(75)           // overflow → +1 hour, :15

Syntax

Call date.setMinutes. Start with this line.

JavaScript
date.setMinutes(m[, sec[, ms]])
CallWhat it does
date.setMinutes(m[, sec[, ms]])Primary signature.
date.setMinutes(...)Call with the arguments your case needs.

Built into JavaScript. Call setMinutes(...) on a Date instance — no import required.

Library declarations
JavaScript
date.setMinutes(m[, sec[, ms]])

Parameters

ParameterDescription
minutesValueRequired. Local minutes (typically 0–59; overflow allowed)
secondsValueOptional. Local seconds; keep current if omitted
msValueOptional. Must also pass seconds if you pass ms

Return Value

Return ValueDescription
*The value returned by date.setMinutes().

JavaScript Examples

Example 1 — Set the Minutes Only

Change the minutes and keep the existing seconds.

JavaScript
const event = new Date(1975, 7, 19, 23, 15, 30);

event.setMinutes(45);

console.log(event.getMinutes()); // 45
console.log(event.getSeconds()); // 30
Try It Yourself

How It Works

  1. Start at 23:15:30. Month index 7 is August.
  2. Call setMinutes(45). Only the minutes argument is provided.
  3. Seconds stay. Because seconds were omitted, they remain 30.
  4. Object mutated. The same event now reads minutes 45.

Example 2 — Set Minutes, Seconds, and Milliseconds Together

Pass multiple arguments to snap to an exact local time within the hour.

JavaScript
const event = new Date(1975, 7, 19, 23, 15, 30);

event.setMinutes(45, 0, 0);

console.log(event.getMinutes());      // 45
console.log(event.getSeconds());      // 0
console.log(event.getMilliseconds()); // 0
Try It Yourself

How It Works

  1. Start from 23:15:30. Seconds are non-zero.
  2. Pass three numbers. setMinutes(45, 0, 0) sets minute, second, and ms.
  3. Snap cleanly. Result is 23:45:00.000 local.
  4. Why it helps. One call clears leftover seconds/ms without separate setters.

Example 3 — Minute Overflow Rolls to the Next Hour

Values outside 0–59 normalize into later hours.

JavaScript
const d = new Date(2026, 2, 15, 10, 30, 0); // Mar 15, 2026 10:30

d.setMinutes(75);

console.log(d.getHours());   // 11
console.log(d.getMinutes()); // 15
Try It Yourself

How It Works

  1. Start at 10:30. Local hour is 10.
  2. Ask for minute 75. That is past the end of the hour.
  3. Engine normalizes. 75 = 60 + 15 → add 1 hour, keep minute 15.
  4. Read back. Hour becomes 11; minutes become 15.

Browser & Runtime Support

Date.prototype.setMinutes() has been in JavaScript since ES1. It is Baseline and works in every modern browser and Node.js — no polyfill needed.

✓ Baseline · ES1

Date.prototype.setMinutes()

Supported everywhere Date exists: Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions.

99% Universal API
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Date.setMinutes() Excellent

Bottom line: Safe to use in any environment. Watch mutation, overflow into hours, and DST when adjusting local minutes. See also the MDN setMinutes() reference.

Frequently Asked Questions

It sets the minutes (0–59) of a Date in local time. Optional arguments can also set seconds and milliseconds. The Date mutates in place and the method returns the new timestamp in milliseconds.
getMinutes() reads the local minute. setMinutes(m) writes a new local minute. They are the read/write pair for the minute hand.
Yes. setMinutes(minute, second, ms) updates all three at once—useful for snapping to :00:00.000.
JavaScript normalizes overflow into the next hour. setMinutes(75) becomes 1 hour and 15 minutes ahead of the hour start.
No. It returns a number (epoch milliseconds). Call setters on the Date variable — do not chain on the return value.
setMinutes() changes the local clock minute. setUTCMinutes() changes the UTC clock minute. For fixed elapsed-time math across DST, prefer setUTCMinutes() or setTime().

Next: setMonth()

Learn how to set the month of a Date in local time (zero-based months).

setMonth() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful