問題描述
如果 JavaScript (new Date()).getTime()
同時從 2 個不同的時區運行,你會得到相同的值嗎?
If JavaScript (new Date()).getTime()
is run from 2 different timezones simultaneously, will you get the same value?
這個值是否會受到運行瀏覽器的機器上設置的系統時間的影響?
Will this value be affected by the system time set on the machine where the browser is running?
推薦答案
是的,受系統時間影響.但是,如果本地時間是正確的(對于計算機設置的任何時區),它在任何時區都應該是相同的.
Yes, it's affected by system time. However, if the local time is correct (for whatever time zone the computer's set to), it should be the same in any time zone.
ECMAScript 標準說(§15.9.1.1):
The ECMAScript standard says (§15.9.1.1):
"時間是在 ECMAScript 中測量的自 1970 年 1 月 1 日以來的毫秒數UTC."
"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC."
這篇關于如果 javascript "(new Date()).getTime()";從 2 個不同的時區運行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!