爲什麼這段代碼返回明天的日期?toISOString()返回錯誤日期
因爲我們是8月31日,它必須返回2013-08-31而不是2013-09-01。
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>
因爲它是UTC – soulcheck
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString – Nayuki
我該如何看待MY Jour而不是UTC? – Francois