Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JavaScript 如何确定用户的时区?
例如,如果我运行new Date(),则输出为Tue May 28 2013 11:51:03 GMT-0700 (Pacific Daylight Time)。它知道偏移量是 GMT-0700。
new Date()
Tue May 28 2013 11:51:03 GMT-0700 (Pacific Daylight Time)
Web 浏览器中的 JavaScript 只是从本地系统服务中获取时间。如果夏威夷的用户将他们的计算机设置为中欧时间,那么 JavaScript 会认为它在布拉迪斯拉发运行。