JavaScript toUTCString() method

The JavaScript date toUTCString() method is used to get the particular date in the form of a string using the UTC time zone.

Syntax:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
dateObj.toUTCString();
dateObj.toUTCString();
dateObj.toUTCString();

Return:
String representation of date portion of a Date object UTC time zone.

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<script>
var bday=new Date("November 16, 1994 21:10:10");
document.writeln(bday.toUTCString());
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> var bday=new Date("November 16, 1994 21:10:10"); document.writeln(bday.toUTCString()); </script> </body> </html>
<!DOCTYPE html>
<html>
<body>
<script>
var bday=new Date("November 16, 1994 21:10:10");
document.writeln(bday.toUTCString());
</script>
</body>
</html>