代码编辑器:
x
1
<p id="demo">单击按钮以显示当地时间,使用UTC日期-时间</p>
2
<button onclick="myFunction()">点我</button>
3
<script>
4
function myFunction(){
5
var d = new Date(Date.UTC(2012,02,30));
6
var x = document.getElementById("demo");
7
x.innerHTML=d;
8
}
9
</script>
10