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

杀马特。学长 韩版系。学妹 提交于 2019-12-01 06:51:08

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.

Same problem here in my script. Windows was showing 15:47 and the "date" command in gitbash was answering 13:47.

export TZ="CEST-2" 

This fixed the problem for me. I wanted Paris time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!