Javascript - Date toUTCString() Method

The toUTCString() method converts a Date object to a string, according to universal time.

Description

The toUTCString() method converts a Date object to a string, according to universal time.

UTC time is the same as GMT time.

Syntax

Date.toUTCString()

Return

A String, representing the UTC date and time as a string

Example

Convert a Date object to a string, according to universal time:

Demo

//display the UTC date and time as a string.
var d = new Date();
var n = d.toUTCString();
console.log(n);/*from  w ww .j  a  v a 2  s. co m*/

Result