JavaScript tutorial:
toUTCString method

 

Applies to: Date Object

The toUTCString method is use to converted a date to a string using Universal Coordinated Time (UTC).

Syntax

objDate.toUTCString()

Return

Returns a string using UTC format.

Example

The toUTCString method returns a String object that contains the date formatted using UTC convention in a convenient, easily readable form.

The following example illustrates the use of the toUTCString method:

d = new Date();
s = "Current setting is ";
s += d.toUTCString();
alert(s);

To run the code above, paste it into JavaScript Editor, and click the Execute button

See also: Date Object Methods, toGMTString Method