Can I make node.js Date always be in UTC/GMT?

前端 未结 2 1406
我在风中等你
我在风中等你 2020-12-30 00:08

My app runs on Linux servers, where the time (naturally) set to UTC/GMT. However the app is developed on Mac desktops where the time is typically set to a local timezone.

2条回答
  •  情话喂你
    2020-12-30 00:28

    You can use TZ configuration parameter of node.js as follows.

    For bash (and related)

    export TZ=UTC
    

    For Powershell

    $env:TC = 'UTC'
    

    Then for both:

    nodejs server/index.js
    

提交回复
热议问题