toUTCString() formats a Date as a readable UTC string in RFC 1123 style—weekday, day, month, year, time, and GMT. It is useful for HTTP headers and logs; for JSON APIs, prefer toISOString().
01
Syntax
toUTCString()
02
UTC
Always GMT
03
RFC 1123
HTTP dates
04
vs ISO
Different text
05
Logs
UTC labels
06
Invalid
“Invalid Date”
Fundamentals
Introduction
When you need a human-readable timestamp in Coordinated Universal Time, toUTCString() converts any valid Date instant into a standardized GMT string. Unlike toString(), which uses local time, this method always expresses the instant in UTC.
For machine-readable JSON and databases, use toISOString() instead. For locale-aware display, use toLocaleString(). toUTCString() shines in HTTP Date headers and server logs where RFC 1123 text is expected.
Concept
Understanding the toUTCString() Method
Date.prototype.toUTCString() returns a string like:
ddd, dd mmm yyyy HH:MM:SS GMT
Example: Sun, 15 Mar 2026 09:00:00 GMT
ddd — abbreviated weekday (Sun, Mon, …)
mmm — abbreviated English month (Jan, Feb, …)
Clock fields use 24-hour UTC time with zero-padded seconds.
💡
Beginner Tip
toGMTString() is an older alias that returns the same value. It is deprecated—use toUTCString() in new code. The underlying instant is unchanged; only the text representation differs from local formatters.
Foundation
📝 Syntax
JavaScript
dateObj.toUTCString()
Parameters
None.
Return value
An RFC 1123 UTC string with a trailing GMT suffix.
"Invalid Date" if the Date is invalid.
Cheat Sheet
⚡ Quick Reference
Goal
Code
RFC 1123 UTC string
date.toUTCString()
ISO 8601 UTC string
date.toISOString()
Local default string
date.toString()
HTTP Date header value
date.toUTCString()
Deprecated alias
date.toGMTString()
Validate first
Number.isNaN(date.getTime())
Compare
📋 toUTCString() vs Similar Methods
Same instant, different string formats for different jobs.
toUTCString()
RFC 1123
HTTP / logs
toISOString()
ISO 8601
JSON / APIs
toString()
local
Debug
toLocaleString()
locale
User UI
Hands-On
Examples Gallery
Open DevTools Console (F12) or use Try-it links. Examples use Date.UTC() so UTC output is predictable.
📚 Getting Started
Format a fixed UTC instant as an RFC 1123 string.
Example 1 — Basic toUTCString() Output
March 15, 2026 at 09:00 UTC becomes a readable GMT string.
JavaScript
const date = new Date(Date.UTC(2026, 2, 15, 9, 0, 0));
const utcText = date.toUTCString();
console.log(utcText);
// "Sun, 15 Mar 2026 09:00:00 GMT"
The trailing GMT confirms UTC. Month names are always English abbreviations in this format.
📈 Practical Patterns
Compare formatters, local vs UTC views, HTTP headers, and validation.
Example 2 — Compare toUTCString(), toISOString(), and toString()
One instant, three string formats for three different purposes.
JavaScript
const date = new Date(Date.UTC(2026, 2, 15, 9, 0, 0));
console.log(date.toUTCString()); // RFC 1123 UTC
console.log(date.toISOString()); // ISO 8601 UTC
console.log(date.toString()); // local default
HTTP Date, Last-Modified, and Expires headers traditionally use this format. For JSON REST bodies, prefer ISO instead.
Example 5 — Invalid Date Returns "Invalid Date"
Bad inputs produce a string instead of throwing.
JavaScript
const bad = new Date('not-a-date');
console.log(bad.toUTCString()); // "Invalid Date"
if (Number.isNaN(bad.getTime())) {
console.log('Cannot format UTC string');
}
Server logs — human-readable UTC timestamps in text logs.
Email date headers — RFC 1123-style message timestamps.
Debugging UTC view — compare against local toString() output.
Legacy integrations — systems expecting GMT text instead of ISO.
Teaching — show how UTC differs from local string formatters.
🧠 How toUTCString() Builds the GMT Label
1
Read instant
Engine loads the Date’s epoch milliseconds.
getTime
2
UTC fields
Weekday, day, month, year, and clock are computed in UTC.
UTC
3
Format RFC 1123
English month abbreviations and GMT suffix are assembled.
RFC
4
🌐
Return string
A new UTC text string is returned; the Date object is unchanged.
Important
📝 Notes
Always UTC with a GMT suffix—never local offset text.
Read-only: does not mutate the Date.
RFC 1123 format differs from ISO 8601—do not confuse the two in APIs.
toGMTString() is deprecated but returns the same string.
Invalid dates return "Invalid Date"—unlike toISOString() which throws.
For JSON payloads, prefer toISOString() over toUTCString().
Compatibility
Browser & Runtime Support
Date.prototype.toUTCString() has been available since early JavaScript. It works in every modern browser and Node.js.
✓ Baseline · ES1
Date.prototype.toUTCString()
Supported everywhere JavaScript runs — browsers, Node.js, Deno, and Bun. No polyfill required.
100%Universal API
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Date.toUTCString()Universal
Bottom line: Safe everywhere. Remember RFC 1123 for HTTP, ISO for JSON, and GMT always.
Wrap Up
Conclusion
toUTCString() gives you a readable Coordinated Universal Time label in RFC 1123 form. Use it for HTTP headers and UTC logs; use toISOString() when machines need to parse the value.
Next, learn Date.UTC() to construct UTC timestamps from numeric parts, or review toTimeString() for the local clock half of default strings.
Compare with toISOString() to see two UTC text formats
Validate with Number.isNaN(date.getTime()) before formatting
Prefer toISOString() in JSON REST APIs
Use Date.UTC() when building fixed UTC examples
❌ Don’t
Send toUTCString() in JSON when partners expect ISO 8601
Parse RFC 1123 strings with brittle regex when Date parsing exists
Use toGMTString() in new code—use toUTCString()
Assume local toString() shows the same calendar date as UTC
Store toUTCString() text as your canonical timestamp format
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Date.toUTCString()
Your foundation for RFC 1123 UTC strings in JavaScript.
5
Core concepts
📝01
Syntax
toUTCString()
API
🌐02
UTC GMT
Always.
Timezone
📋03
RFC 1123
HTTP dates.
Format
📦04
vs ISO
JSON uses ISO.
Compare
⚠05
Invalid
“Invalid Date”.
Guard
❓ Frequently Asked Questions
An RFC 1123 UTC string such as "Sun, 15 Mar 2026 09:00:00 GMT". It includes weekday, day, month, year, time, and a trailing GMT suffix.
Both represent the same UTC instant, but with different formats. toISOString() returns ISO 8601 (2026-03-15T09:00:00.000Z). toUTCString() returns RFC 1123 with a GMT suffix. Modern JSON APIs usually prefer ISO.
Yes. toGMTString() is a deprecated alias that returns the same string as toUTCString(). Prefer toUTCString() in new code.
Usually no — use toISOString() or toJSON() for machine-readable JSON. toUTCString() is common for HTTP Date headers and human-readable UTC logs.
No. It is read-only—it returns a new string and leaves the Date unchanged.
It returns the string "Invalid Date". Validate with Number.isNaN(date.getTime()) before formatting.
Did you know?
The HTTP specification expects Date header values in IMF-fixdate format—the same family as JavaScript’s toUTCString() output with a GMT suffix.