Example 1 — Set the UTC Day of Month
MDN: read the UTC day, then change it with setUTCDate().
const event = new Date("August 19, 1975 23:15:30 GMT-3:00");
console.log(event.getUTCDate()); // 20
event.setUTCDate(19);
console.log(event.getUTCDate()); // 19 How It Works
- Parse with offset.
GMT-3:00shifts the instant so UTC day is20. - Read.
getUTCDate()reports20. - Write.
setUTCDate(19)sets the UTC calendar day to19. - Object mutated. The same
eventnow reads day19.

