Example 1 — Set the UTC Minute Only
Move the UTC minute to 10 while keeping seconds.
const date = new Date(Date.UTC(2026, 2, 1, 12, 30, 45));
date.setUTCMinutes(10);
console.log(date.getUTCMinutes()); // 10
console.log(date.getUTCSeconds()); // 45
console.log(date.toISOString()); // "2026-03-01T12:10:45.000Z" How It Works
- Build a UTC date.
Date.UTC(2026, 2, 1, 12, 30, 45)is March 1, 2026 at 12:30:45 UTC. - Change only the minute.
setUTCMinutes(10)writes minute10and leaves seconds alone. - Read it back.
getUTCMinutes()→10,getUTCSeconds()→45. - Confirm ISO. The trailing
Zmeans UTC —12:10:45.000Z.

