【发布时间】:2013-09-04 10:47:24
【问题描述】:
为什么这段代码返回明天的日期?
它必须返回 2013-08-31 而不是 2013-09-01,因为我们是 8 月 31 日。
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_toisostring
function myFunction() {
var d = new Date();
var x = document.getElementById("demo");
x.innerHTML = d.toISOString();
}
<p id="demo">Click the button to display the date and time as a string, using the ISO
standard.</p>
<button onclick="myFunction()">Try it</button>
【问题讨论】:
-
我怎样才能拿我的 jour 而不是 UTC one ?
标签: javascript date