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);//ww  w .j a va2  s.c  o  m

Result