JavaScript Date toUTCString() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Date

Definition

Date.prototype.toUTCString() returns a string for this instant in the RFC 7231 layout, always in UTC, ending with GMT (for example "Wed, 14 Jun 2017 07:00:00 GMT"). It is read-only and does not change the Date.

Remember
date.toUTCString()

→ "Wed, 14 Jun 2017 07:00:00 GMT"
→ "Invalid Date"                  (if invalid)

Format (always UTC):
  Www, dd Mmm yyyy HH:mm:ss GMT

toISOString() → "2017-06-14T07:00:00.000Z"
toString()    → local date + time
toGMTString() → same as toUTCString() (legacy alias)

Syntax

Call date.toUTCString. Start with this line.

JavaScript
date.toUTCString()
CallWhat it does
date.toUTCString()Primary signature.
date.toUTCString(...)Call with the arguments your case needs.

Built into JavaScript. Call toUTCString(...) on a Date instance — no import required.

Library declarations
JavaScript
date.toUTCString()

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The value returned by date.toUTCString().

JavaScript Examples

Example 1 — Format a UTC Instant

Convert a parsed date into an RFC 7231 UTC string.

JavaScript
const event = new Date("14 Jun 2017 00:00:00 PDT");

console.log(event.toUTCString());
// "Wed, 14 Jun 2017 07:00:00 GMT"
Try It Yourself

How It Works

  1. Parse an input. "14 Jun 2017 00:00:00 PDT" is midnight in Pacific Daylight Time.
  2. Convert to UTC. PDT is UTC−7, so midnight PDT is 07:00 UTC.
  3. Format. toUTCString() prints weekday, date, time, and GMT.
  4. Stable timezone. Unlike toString(), the result does not depend on your local offset.

Example 2 — toUTCString() vs ISO vs Local

Same instant, three different string shapes.

JavaScript
const d = new Date(Date.UTC(2026, 2, 1, 12, 30, 45));

console.log(d.toUTCString()); // "Sun, 01 Mar 2026 12:30:45 GMT"
console.log(d.toISOString()); // "2026-03-01T12:30:45.000Z"
console.log(d.toString());    // local date + time (varies)
Try It Yourself

How It Works

  1. Fix a UTC instant. Date.UTC(2026, 2, 1, 12, 30, 45) is March 1 at 12:30:45 UTC.
  2. RFC text. toUTCString() uses spaces and GMT.
  3. ISO text. toISOString() uses T, milliseconds, and Z.
  4. Local text. toString() follows the machine timezone (sample shows +0530).

Example 3 — Invalid Date Handling

Bad parses return the string "Invalid Date" (no exception).

JavaScript
const bad = new Date("not-a-date");

console.log(bad.toUTCString()); // "Invalid Date"
console.log(Number.isNaN(bad.getTime())); // true
Try It Yourself

How It Works

  1. Create an invalid Date. Unparseable strings make getTime() return NaN.
  2. Format anyway. toUTCString() returns the literal "Invalid Date".
  3. No throw. Unlike toISOString(), this method does not raise RangeError.
  4. Validate first. Check Number.isNaN(date.getTime()) if you need a custom message.

Browser & Runtime Support

Date.prototype.toUTCString() has been in JavaScript since ES1. It is Baseline and works in every modern browser and Node.js — no polyfill needed.

✓ Baseline · ES1

Date.prototype.toUTCString()

Supported everywhere Date exists: Chrome, Firefox, Safari, Edge, Internet Explorer, and all Node.js versions.

99% 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() Excellent

Bottom line: Safe to use in any environment. Prefer it over legacy toGMTString(). See also the MDN toUTCString() reference.

Frequently Asked Questions

A UTC string in the RFC 7231 form Www, dd Mmm yyyy HH:mm:ss GMT — for example "Wed, 14 Jun 2017 07:00:00 GMT". The timezone is always UTC.
Both describe the same UTC instant. toISOString() returns ISO 8601 with a Z suffix ("2017-06-14T07:00:00.000Z"). toUTCString() returns the older GMT English layout. Modern JSON APIs usually prefer ISO.
Yes. toGMTString() is a legacy alias for the same function. Prefer toUTCString() in new code — the name better matches UTC behavior.
Usually no. Prefer toISOString() or toJSON() for machine-readable JSON. toUTCString() is common for HTTP Date-style text 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" (it does not throw). Validate with Number.isNaN(date.getTime()) if you need custom handling.

Next: Date.UTC()

Learn how to build epoch milliseconds from UTC year, month, and day 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.

11 people found this page helpful