JavaScript将当前时间转换成UTC标准时间的方法_Javascript教程-查字典教程网
JavaScript将当前时间转换成UTC标准时间的方法
JavaScript将当前时间转换成UTC标准时间的方法
发布时间:2016-12-30 来源:查字典编辑
摘要:本文实例讲述了JavaScript将当前时间转换成UTC标准时间的方法。分享给大家供大家参考。具体如下:这里使用JavaScript将当前时...

本文实例讲述了JavaScript将当前时间转换成UTC标准时间的方法。分享给大家供大家参考。具体如下:

这里使用JavaScript将当前时间转换成UTC标准时间,北京在东八区,在北京时间基础上减掉8小时

<!DOCTYPE html> <html> <body> <p id="demo"> Click the button to display the UTC date and time as a string. </p> <button>Try it</button> <script> function myFunction() { var d = new Date(); var x = document.getElementById("demo"); x.innerHTML=d.toUTCString(); } </script> </body> </html>

希望本文所述对大家的javascript程序设计有所帮助。

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类