JS Built-ins
← Date19 / 120
DateUTCintermediate

Date.UTC() β€” 1 second after epoch

πŸ“– Usage Example
Date.UTC(2024, 0, 15)  // β†’ 1705276800000
// month is 0-indexed
new Date(Date.UTC(2024, 0, 15)).toISOString()  // β†’ '2024-01-15T00:00:00.000Z'

Use Date.UTC() to compute the millisecond timestamp for a UTC date without constructing a Date object first.

Date.UTC()

Adding 1 second (1000 ms) to the epoch: Date.UTC(1970, 0, 1, 0, 0, 1) returns 1000.

Challenge: Verify that Date.UTC(1970, 0, 1, 0, 0, 1) returns 1000.

πŸ’‘ Hints (1)
  • β€’ Date.UTC accepts (year, month, day, hours, minutes, seconds, ms) β€” 1 second = 1000 ms