Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

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

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:57 GMT 2014

Also setting TZ will not change things:

$ TZ="Europe/Berlin" date
Mon Mar 31 16:09:01 GMT 2014

Similarly all times it git log are GMT only.

Is there a way to set the correct timezone in git-bash?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...