JS Built-ins
← Date17 / 120
DateUTCbeginner

Date.UTC() β€” 2024 date is positive

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

Date.UTC(2024, 0, 15) returns a large positive number (ms since epoch for Jan 15, 2024 UTC).

Challenge: Verify that Date.UTC(2024, 0, 15) > 0.

πŸ’‘ Hints (1)
  • β€’ Dates after 1970 produce positive UTC timestamps