JS Built-ins
← Date15 / 120
Dateparseintermediate

Date.parse() β€” epoch boundary (1970-01-01)

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

Date.parse('1970-01-01') may return 0 or a small positive offset depending on the local timezone, but is always >= 0.

Challenge: Verify that Date.parse('1970-01-01') >= 0.

πŸ’‘ Hints (1)
  • β€’ Without a timezone suffix, date strings may be parsed as local time β€” use Z suffix for UTC