JS Built-ins
← Date108 / 120
DatetoUTCStringbeginner

toUTCString() β€” includes "GMT"

πŸ“– 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 result always contains "GMT" to indicate UTC time.

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

πŸ’‘ Hints (1)
  • β€’ GMT (Greenwich Mean Time) = UTC; toUTCString() always appends "GMT"