1
<p id="demo">点击按钮把 utc 日期和时间转换成字符串。</p>
2
<button onclick="myFunction()">点我</button>
3
<script>
4
function myFunction() {
5
var d = new Date();
6
var x = document.getElementById("demo");
7
x.innerHTML = d.toUTCString();
8
}
9
</script>