JS Built-ins
← Date12 / 120
Dateparsebeginner

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

πŸ“– Usage Example
Date.parse('2024-01-15T00:00:00.000Z')  // β†’ 1705276800000
Date.parse('invalid')  // β†’ NaN

Use Date.parse() to convert a date string into a millisecond timestamp, or detect invalid strings by checking for NaN.

Date.parse()

Any date string after the epoch returns a positive number.

Challenge: Verify that Date.parse('2024-01-15') returns a number greater than 0.

πŸ’‘ Hints (1)
  • β€’ All dates after 1970 produce a positive timestamp in milliseconds