JavaScript Date setMinutes() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Local minute (0–59)

What You’ll Learn

setMinutes() writes the minute (0–59) on a Date in local time, with optional seconds and milliseconds. This guide covers syntax, scheduling patterns, overflow, and comparisons with UTC setters.

01

Syntax

setMinutes(m)

02

0–59

Minutes

03

Overload

m, s, ms

04

Mutates

In place

05

+ minutes

getMinutes + n

06

Returns

Epoch ms

Introduction

“Start in 15 minutes,” “round to the top of the hour,” and time-picker forms all need to change the minute hand on a Date. After reading minutes with getMinutes(), setMinutes() writes them back in local time.

Like other setters, it mutates the original object and returns epoch milliseconds—not the Date for chaining.

Understanding the setMinutes() Method

Date.prototype.setMinutes(minute [, second [, millisecond]]) accepts a local minute and up to two optional sub-minute fields. When you pass only the minute, the hour stays the same unless overflow normalization rolls into the next hour.

Values outside normal ranges roll forward or backward— setMinutes(75) on 12:30 becomes 13:15. For UTC minute writes, use setUTCMinutes().

💡
Beginner Tip

To snap to the top of the hour: date.setMinutes(0, 0, 0). To add fifteen minutes: date.setMinutes(date.getMinutes() + 15).

📝 Syntax

JavaScript
dateObj.setMinutes(minute)
dateObj.setMinutes(minute, second)
dateObj.setMinutes(minute, second, millisecond)

Parameters

  • minute — Integer 0–59 in local time (overflow normalizes).
  • second (optional) — 0–59.
  • millisecond (optional) — 0–999.

Return value

  • Updated epoch milliseconds after the change.
  • NaN if the Date was invalid before the call.

⚡ Quick Reference

GoalCode
Set minute onlydate.setMinutes(30)
Top of the hourdate.setMinutes(0, 0, 0)
Add 15 minutesdate.setMinutes(date.getMinutes() + 15)
Set m, s, ms togetherdate.setMinutes(45, 30, 500)
Read minute after setdate.getMinutes()
Clone before mutateconst copy = new Date(date)

📋 setMinutes() vs Similar Methods

Pick the setter that matches the time field and timezone you need.

setMinutes()
local 0–59

Local minute

getMinutes()
read

Getter pair

setHours()
hour

Hour setter

setUTCMinutes()
UTC 0–59

UTC setter

Examples Gallery

Open DevTools Console (F12) or use Try-it links. Examples use the Date constructor for predictable local times.

📚 Getting Started

Change only the minute while keeping the hour and seconds.

Example 1 — Set the Minute to 30 (Keep Hour and Seconds)

Start at 12:15:45 and move the minute hand to 30.

JavaScript
const date = new Date(2026, 2, 1, 12, 15, 45);
date.setMinutes(30);

console.log(date.getHours());    // 12
console.log(date.getMinutes());  // 30
console.log(date.getSeconds());  // 45
Try It Yourself

How It Works

Passing one argument updates only the minute. Hour and seconds remain unless normalization rolls the clock.

📈 Practical Patterns

Hour snaps, relative minutes, combined fields, and overflow.

Example 2 — Snap to the Top of the Hour (setMinutes(0, 0, 0))

Reset minutes, seconds, and milliseconds to zero while keeping the hour.

JavaScript
const date = new Date(2026, 2, 1, 14, 37, 22, 800);
date.setMinutes(0, 0, 0);

console.log(date.getHours());         // 14
console.log(date.getMinutes());       // 0
console.log(date.getSeconds());       // 0
console.log(date.getMilliseconds());  // 0
Try It Yourself

How It Works

The three-argument form clears sub-minute precision—handy for hourly reports or bucketed analytics.

Example 3 — Add Fifteen Minutes with setMinutes(getMinutes() + 15)

Postpone a reminder by fifteen local minutes.

JavaScript
const date = new Date(2026, 2, 1, 12, 50, 30);
date.setMinutes(date.getMinutes() + 15);

console.log(date.getHours());    // 13
console.log(date.getMinutes());  // 5
console.log(date.getSeconds());  // 30
Try It Yourself

How It Works

12:50 + 15 minutes crosses into the next hour at 13:05. Overflow adjusts the hour automatically.

Example 4 — Set Minutes, Seconds, and Milliseconds Together

Use the three-argument overload for an exact sub-hour timestamp.

JavaScript
const date = new Date(2026, 2, 1, 9, 0, 0, 0);
date.setMinutes(45, 30, 500);

console.log(date.getMinutes());       // 45
console.log(date.getSeconds());       // 30
console.log(date.getMilliseconds());  // 500
Try It Yourself

How It Works

When you need a precise :45:30.500 mark, one call beats three separate setters—and the return value is still epoch ms, not the Date.

Example 5 — Minute Overflow (setMinutes(75))

Passing 75 rolls into the next hour at minute 15.

JavaScript
const date = new Date(2026, 2, 1, 12, 30, 45);
date.setMinutes(75);

console.log(date.getHours());    // 13
console.log(date.getMinutes());  // 15
console.log(date.getSeconds());  // 45
Try It Yourself

How It Works

75 minutes = 1 hour + 15 minutes. The engine normalizes instead of clamping to 0–59.

🚀 Common Use Cases

  • Meeting delays — push start time with getMinutes() + N.
  • Hourly bucketssetMinutes(0, 0, 0) for report windows.
  • Time pickers — apply user-selected minutes to a Date.
  • Cron-style snaps — align to :00 or :30 marks.
  • Test fixtures — pin exact minute/second/ms in unit tests.
  • Clone + mutate — copy a Date before changing minutes for comparisons.

🧠 How setMinutes() Updates the Clock

1

Read local time

Engine loads current local hour, minute, and sub-minute fields.

Local
2

Apply new minute

Minute and optional second/ms replace old sub-hour values.

setMinutes
3

Normalize overflow

Out-of-range values roll into adjacent hours or days.

Normalize
4

Mutate & return ms

Date updates in place; epoch milliseconds are returned.

📝 Notes

  • setMinutes() uses local time minutes 0–59 (overflow normalizes).
  • Mutates the original Date—clone with new Date(date) when needed.
  • Returns epoch ms, not the Date—no fluent chaining on the return value.
  • Optional second and millisecond args default to 0 when omitted after minute.
  • For adding duration across hours, getMinutes() + N is simpler than manual hour math.
  • Use setUTCMinutes when rules follow UTC, not local wall clock.

Browser & Runtime Support

Date.prototype.setMinutes() has been available since ES1. It works in every browser and Node.js.

Baseline · ES1

Date.prototype.setMinutes()

Supported in Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions. No polyfill required.

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 everywhere. Remember mutation, overflow, and the three-argument snap pattern.

Conclusion

setMinutes() writes the local minute (and optionally seconds and milliseconds) on a JavaScript Date. Use it for scheduling shifts and hour snaps; clone first when preserving the original instant.

Next, learn setMonth() to change the calendar month, or review getMinutes() for reading the minute.

💡 Best Practices

✅ Do

  • Use setMinutes(0, 0, 0) to snap to the top of the hour
  • Use getMinutes() + N for relative minute shifts
  • Clone before mutating shared Date instances
  • Pair with getMinutes() to verify results
  • Use setUTCMinutes for UTC scheduling rules

❌ Don’t

  • Assume setters return the Date for chaining
  • Wrap the return value in new Date(...) expecting a copy
  • Assume values clamp at 59 (overflow rolls hours)
  • Mix local setters with UTC getters in one label
  • Forget that omitted second/ms args become 0 in overload calls

Key Takeaways

Knowledge Unlocked

Five things to remember about Date.setMinutes()

Your foundation for local minute writes in JavaScript.

5
Core concepts
🔢 02

0–59

Minutes.

Range
📈 03

3 args

m, s, ms.

Overload
04

+ minutes

getMinutes + n.

Pattern
🔄 05

Mutates

In place.

Behavior

❓ Frequently Asked Questions

It sets the minutes (0–59) of a Date object in local time. Optional arguments can also set seconds and milliseconds. The Date mutates in place and returns updated epoch milliseconds.
getMinutes() reads the current local minute. setMinutes(m) writes a new minute. They are the read/write pair for the minute hand of the local clock.
Yes. setMinutes(minute, second, millisecond) updates all three sub-hour fields at once—useful for snapping to :00:00.000 at the top of an hour.
JavaScript normalizes overflow into the next hour. setMinutes(75) on 12:30 becomes 13:15 (75 minutes = 1 hour + 15 minutes).
No. It returns a number (epoch milliseconds). Call each setter on the same Date variable—do not chain on the return value.
setMinutes() changes the local clock minute. setUTCMinutes() changes the UTC clock minute. Use the one that matches your timezone rules.
Did you know?

setMinutes(0, 0, 0) keeps the current hour but clears minutes, seconds, and milliseconds—unlike the old tutorial myth, setters do mutate the original Date; they do not return a new copy.

Continue to setMonth()

Learn how to set the calendar month (0–11) on a Date object in local time.

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.

6 people found this page helpful