Example 1 — MDN Moon Landing Instant
Read UTC seconds from the classic Apollo 11 timestamp.
const moonLanding = new Date("July 20, 1969, 20:18:04 UTC");
console.log(moonLanding.getUTCSeconds()); // 4 How It Works
- Parse a UTC string. The
UTCsuffix pins the instant to universal time. - Read the field.
getUTCSeconds()returns the seconds part:4. - Range. Valid results stay in
0–59. - Read-only. The call does not change
moonLanding.

