如何在git bash中设置正确的本地时区? [英] How to set the correct local time zone in git bash?

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

问题描述

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

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

  $ date 
3月31日星期一16:08:57 GMT 2014

另外设置TZ不会改变事情:

  $ TZ =欧洲/柏林日期
3月31日星期一16:09:01 GMT 2014

同样,所有时间 git log 仅仅是GMT。



有没有办法在git- bash?

解决方案在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中设置正确的本地时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆