Forgot password
 Register account
View 216|Reply 0

getTimezoneOffset() 和历史数据

[Copy link]

3156

Threads

7932

Posts

45

Reputation

Show all posts

hbghlyj posted 2025-3-5 03:44 |Read mode
由于历史原因,一个地区的时区可能会不断变化,即使不考虑夏令时。例如,下面是在上海运行 Javascript 时的输出,时区为 UTC+08:00。
  1. const shModernOffset = new Date("2022-01-27").getTimezoneOffset(); // -480
  2. const shHistoricalOffset = new Date("1943-01-27").getTimezoneOffset(); // -540
Copy the Code
en.wikipedia.org/wiki/Historical_time_zones_of_China
1939 年中日战争期间,全中国采用 UTC +7。在中日战争期间,上海在日本控制下,时区被改为 UTC+09:00 以与日本对齐(实际上是“全年夏令时”),这在 IANA 数据库中有记录。
第二次世界大战后又恢复了五个时区 UTC+05:30、+06:00、+07:00、+08:00、08:30
1949 年中国内战结束后,共产党掌权,全中国采用 UTC+8。

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-6-8 17:24 GMT+8

Powered by Discuz!

Processed in 0.017093 second(s), 21 queries

× Quick Reply To Top Edit