JavaScript Date toUTCString() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
RFC 1123 UTC

What You’ll Learn

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”

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.

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.

📝 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.

⚡ Quick Reference

GoalCode
RFC 1123 UTC stringdate.toUTCString()
ISO 8601 UTC stringdate.toISOString()
Local default stringdate.toString()
HTTP Date header valuedate.toUTCString()
Deprecated aliasdate.toGMTString()
Validate firstNumber.isNaN(date.getTime())

📋 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

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"
Try It Yourself

How It Works

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
Try It Yourself

How It Works

All three strings describe the same instant. Choose ISO for JSON, RFC 1123 for HTTP-style text, and toString() for local debugging.

Example 3 — Same Local Clock, Different UTC Calendar Day

Near midnight, local toString() and UTC toUTCString() can show different dates.

JavaScript
// Local: Mar 16 2026 01:00 (example in UTC+5:30)
const lateLocal = new Date(2026, 2, 16, 1, 0, 0);

console.log(lateLocal.toString());
console.log(lateLocal.toUTCString());
Try It Yourself

How It Works

Local 01:00 on March 16 in UTC+5:30 is still March 15 in UTC. Always know which timezone your formatter uses.

Example 4 — Build an HTTP-Style Date Header Value

Servers often emit RFC 1123 UTC timestamps in response headers.

JavaScript
const now = new Date(Date.UTC(2026, 2, 15, 9, 0, 0));
const httpDate = now.toUTCString();

const headerLine = `Date: ${httpDate}`;
console.log(headerLine);
// Date: Sun, 15 Mar 2026 09:00:00 GMT
Try It Yourself

How It Works

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');
}
Try It Yourself

How It Works

Unlike toISOString(), which throws on invalid dates, toUTCString() returns the literal text "Invalid Date".

🚀 Common Use Cases

  • HTTP response headersDate, Last-Modified, Expires.
  • 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.

📝 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().

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 Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
Date.toUTCString() Universal

Bottom line: Safe everywhere. Remember RFC 1123 for HTTP, ISO for JSON, and GMT always.

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.

💡 Best Practices

✅ Do

  • Use toUTCString() for HTTP Date header values
  • 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

Key Takeaways

Knowledge Unlocked

Five things to remember about Date.toUTCString()

Your foundation for RFC 1123 UTC strings in JavaScript.

5
Core concepts
🌐 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.

Continue to Date.UTC()

Learn the static method that creates UTC epoch milliseconds from year, month, day, and time parts.

Date.UTC() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful