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)