The example in this article describes how JavaScript converts the current time into UTC standard time. Share it with everyone for your reference. The details are as follows:
Here, JavaScript is used to convert the current time into UTC standard time. Beijing is in the East Eighth District, and 8 hours are subtracted from Beijing time
<!DOCTYPE html> <html> <body> <p id="demo"> Click the button to display the UTC date and time as a string. </p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var d = new Date(); var x = document.getElementById("demo"); x.innerHTML=d.toUTCString(); } </script> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.