TZ
TZ 环境变量用于指定时区配置。
【The TZ environment variable is used to specify the timezone configuration.】
虽然 Node.js 并不支持所有类型的 在其他环境中处理 TZ 的方式,但它确实支持基本的 时区 ID(例如 'Etc/UTC'、'Europe/Paris' 或 'America/New_York')。
它可能支持其他一些缩写或别名,但这些强烈不推荐使用,也无法保证可用。
【While Node.js does not support all of the various ways that TZ is handled in
other environments, it does support basic timezone IDs (such as
'Etc/UTC', 'Europe/Paris', or 'America/New_York').
It may support a few other abbreviations or aliases, but these are strongly
discouraged and not guaranteed.】
$ TZ=Europe/Dublin node -pe "new Date().toString()"
Wed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time)