JS Built-ins
← Date56 / 120
DategetMillisecondsbeginner

getMilliseconds() β€” returns 500

πŸ“– 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()

Returns the milliseconds component (0–999) in local time.

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

πŸ’‘ Hints (1)
  • β€’ The 7th argument to the Date constructor is milliseconds (0–999)