用JS将当前时间转换成UTC标准时间的方法
来源:绵阳动力网络公司  时间:2015-04-08  阅读:20
这篇文章主要介绍了JavaScript将当前时间转换成UTC标准时间的方法,涉及javascript中Date及toUTCString方法的使用技巧,这里使用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 onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var d = new Date();
var x = document.getElementById("demo");
x.innerHTML=d.toUTCString();
}
</script>
</body>
</html>
 
  • 电话咨询

  • 0816-2318288