【发布时间】:2019-12-10 21:38:32
【问题描述】:
我在带有 Raspbian Stretch 的 Raspberry Pi 3B 上运行 Node-red。
此输出确认实际设置了 CET 时区:
pi@raspberrypi:~ $ timedatectl
Local time: Tue 2019-12-10 22:29:51 CET
Universal time: Tue 2019-12-10 21:29:51 UTC
RTC time: n/a
Time zone: Europe/Berlin (CET, +0100)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
我正在尝试计算当前时区 (CET) 和 GMT 时间之间的时区偏移量。
为此我在node-red的函数节点中使用了以下行:
msg.payload = new Date().getTimezoneOffset();
但它返回的不是一小时(60 分钟)的预期偏移量,而是 0。
【问题讨论】:
标签: javascript raspberry-pi timezone node-red timezone-offset