JS Built-ins
← Date106 / 120
DatetoUTCStringbeginner

toUTCString() β€” returns a string

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

Returns a human-readable UTC date string like "Mon, 15 Jan 2024 00:00:00 GMT".

Challenge: Verify that typeof new Date(0).toUTCString() returns 'string'.

πŸ’‘ Hints (1)
  • β€’ toUTCString() returns a string representation of the date in UTC