JS Built-ins
← Date99 / 120
DatetoISOStringintermediate

toISOString() β€” length is 24

πŸ“– Usage Example
const d = new Date('2024-01-15T00:00:00.000Z')
d.toISOString()  // β†’ '2024-01-15T00:00:00.000Z'

Use toISOString() to serialize a Date as a UTC ISO 8601 string in the format YYYY-MM-DDTHH:mm:ss.sssZ.

Date.prototype.toISOString()

ISO strings from JavaScript have a fixed length of 24 characters (including milliseconds and "Z").

Challenge: Verify that new Date(0).toISOString().length equals 24.

πŸ’‘ Hints (1)
  • β€’ Format: YYYY-MM-DDTHH:mm:ss.mmmZ β€” exactly 24 characters