JS Built-ins
← Date110 / 120
DatetoUTCStringbeginner

toUTCString() β€” 2024 date includes "2024"

πŸ“– 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 UTC string for a 2024 date contains "2024".

Challenge: Verify that new Date('2024-01-15T00:00:00.000Z').toUTCString().includes('2024') is true.

πŸ’‘ Hints (1)
  • β€’ The year always appears in the toUTCString() output