JS Built-ins
← Date107 / 120
DatetoUTCStringbeginner

toUTCString() β€” epoch includes "1970"

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

Use toUTCString() to get a human-readable UTC date string in RFC 7231 format (e.g., used in HTTP headers).

Date.prototype.toUTCString()

The epoch date's UTC string always contains "1970".

Challenge: Verify that new Date(0).toUTCString().includes('1970') is true.

πŸ’‘ Hints (1)
  • β€’ The epoch is Jan 1 1970, so the year 1970 always appears in the output