JS Built-ins
← Date58 / 120
DategetMillisecondsbeginner

getMilliseconds() β€” returns 999

πŸ“– Usage Example
const d = new Date(2024, 0, 15, 12, 30, 45, 750)
d.getMilliseconds()  // β†’ 750
// returns 0–999

Use getMilliseconds() to retrieve the milliseconds component (0–999) of a Date object in local time.

Date.prototype.getMilliseconds()

999 is the maximum milliseconds value (one ms before a second ticks over).

Challenge: Verify that new Date(2024, 0, 15, 12, 30, 45, 999).getMilliseconds() returns 999.

πŸ’‘ Hints (1)
  • β€’ Milliseconds range from 0 to 999; 1000 would roll over to the next second