How to set the correct local time zone in git bash?

前端 未结 2 1058
臣服心动
臣服心动 2021-01-12 15:21

I am using git-bash on a Windows system.

The Windows clock shows local time, but inside git-bash everything is in GMT time:

$ date
Mon Mar 31 16:08:5         


        
2条回答
  •  走了就别回头了
    2021-01-12 16:14

    On Windows the TZ variable seems to work differently.

    To get the German timezone you have to write:

    TZ=GST-1GDT date
    

    If you set it to some "invalid" value like "Europe/Berlin" it will default to GMT. The same seems to happen on my system when TZ is not set at all.

    With the above setting I get Thu Apr 17 16:23:23 GDT 2014 which is not exactly the same as Thu Apr 17 16:23:23 CEST 2014, but at least the time looks right.

提交回复
热议问题