W3cubDocs

/JavaScript

date.toUTCString

The toUTCString() method converts a date to a string, using the UTC time zone.

Syntax

dateObj.toUTCString()

Return value

A string representing the given date using the UTC time zone.

Description

The value returned by toUTCString() is a human readable string in the UTC time zone. The format of the return value may vary according to the platform. The most common return value is a RFC-1123 formatted date stamp, which is a slightly updated version of RFC-822 date stamps.

Examples

Using toUTCString()

var today = new Date('Wed, 14 Jun 2017 00:00:00 PDT');
var UTCstring = today.toUTCString(); // Wed, 14 Jun 2017 07:00:00 GMT

Specifications

Browser compatibility

Feature Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes Yes Yes Yes Yes
Feature Android webview Chrome for Android Edge mobile Firefox for Android Opera Android iOS Safari Samsung Internet
Basic support Yes Yes Yes Yes Yes Yes ?

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toUTCString