問題描述
如果 JavaScript (new Date()).getTime()
同時(shí)從 2 個(gè)不同的時(shí)區(qū)運(yùn)行,你會(huì)得到相同的值嗎?
If JavaScript (new Date()).getTime()
is run from 2 different timezones simultaneously, will you get the same value?
這個(gè)值是否會(huì)受到運(yùn)行瀏覽器的機(jī)器上設(shè)置的系統(tǒng)時(shí)間的影響?
Will this value be affected by the system time set on the machine where the browser is running?
推薦答案
是的,受系統(tǒng)時(shí)間影響.但是,如果本地時(shí)間是正確的(對(duì)于計(jì)算機(jī)設(shè)置的任何時(shí)區(qū)),它在任何時(shí)區(qū)都應(yīng)該是相同的.
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 標(biāo)準(zhǔn)說(§15.9.1.1):
The ECMAScript standard says (§15.9.1.1):
"時(shí)間是在 ECMAScript 中測量的自 1970 年 1 月 1 日以來的毫秒數(shù)UTC."
"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC."
這篇關(guān)于如果 javascript "(new Date()).getTime()";從 2 個(gè)不同的時(shí)區(qū)運(yùn)行的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!