Date.toUTCString()
Converts a Date object to a string, according to universal time
The toUTCString() method converts a date to a string, using the UTC time zone.
var event = new Date('14 Jun 2017 00:00:00 PDT');
console.log(event.toUTCString());
// expected output: Wed, 14 Jun 2017 07:00:00 GMT
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()
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
References
Contributors to this page
Uros Durdevic
Last updated