bash中设置正确的本地时区

bash中设置正确的本地时区

本文介绍了如何在git bash中设置正确的本地时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在Windows系统上使用git-bash。

Windows时钟显示当地时间,但在git-bash中,一切都在GMT时间内:

 在Windows上, TZ 变量似乎工作。



  TZ = GST-1GDT日期

如果您将其设置为某些无效值,如Europe / Berlin它将默认为GMT。
当我的系统没有设置TZ时,似乎也发生了这种情况。



通过上述设置,我得到 Thu Apr 17 16:23:23 GDT 2014 它与 Thu Apr 17 16:23:23 CEST 2014 不完全相同,但至少在时间看起来不错。


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?

解决方案

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.

这篇关于如何在git bash中设置正确的本地时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 08:58