Javascript examples for Date:toUTCString
The toUTCString() method converts a Date object to a string, according to universal time.
UTC time is the same as GMT time.
None
A String, representing the UTC date and time as a string
The following code shows how to Convert a Date object to a string, according to universal time:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from www . j a v a2 s .c o m*/ var d = new Date(); var n = d.toUTCString(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>