{"thread":{"id":"50858","subject":"[Bug] git log - reports wrong date and time","startedAt":"2019-04-01T22:31:50Z","lastAt":"2019-04-02T15:00:38Z","messageCount":3,"participants":["Chanseok Oh","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"372951","messageId":"CAP5K-1YJN9jt_6yEbLs=ET6M2tRLMMoio65GJMsJy69Y+LCn1g@mail.gmail.com","threadId":"50858","inReplyTo":null,"subject":"[Bug] git log - reports wrong date and time","fromName":"Chanseok Oh","fromEmail":"chanseok@google.com","sentAt":"2019-04-01T22:31:10Z","receivedAt":"2019-04-01T22:31:50Z","isPatch":false,"sender":{"key":"chanseok@google.com","avatar":null},"body":"Hello,\n\nI'm using the latest version.\n\n    $ git version\n    git version 2.21.0.392.gf8f6787159e-goog\n\nWORKS: the following prints out the date and time in my local timezone.\n\n    $ git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)' --format=%cd -n1\n    20190401 170250 -0400 (EDT)\n\nWORKS: \"TZ=UTC\" is respected. It prints time in UTC.\n\n    $ TZ=UTC git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'\n--format=%cd -n1\n    20190401 210250 +0000 (UTC)\n\nBROKEN: anything other than UTC reports wrong date.\n\n    $ TZ=KST git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'\n--format=%cd -n1\n    20190401 210250 +0000 (KST)\n\nThe time is in UTC. Worse, %Z respects TZ=KST, which is in conflict with %z.\n\nThe symptom is same with \"--date=local\". It respects TZ=UTC but\nnothing other than TZ=UTC.\n\nRegards,\nChanseok\n"},{"id":"372955","messageId":"xmqq7ecdutq2.fsf@gitster-ct.c.googlers.com","threadId":"50858","inReplyTo":"CAP5K-1YJN9jt_6yEbLs=ET6M2tRLMMoio65GJMsJy69Y+LCn1g@mail.gmail.com","subject":"Re: [Bug] git log - reports wrong date and time","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-04-02T00:38:29Z","receivedAt":"2019-04-02T00:38:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Chanseok Oh <chanseok@google.com> writes:\n\n> BROKEN: anything other than UTC reports wrong date.\n>\n>     $ TZ=KST git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'\n> --format=%cd -n1\n>     20190401 210250 +0000 (KST)\n\nI think you are probably on a system where timezones can be given\nonly with a more modern and unambiguous style and not in the\npotentially ambiguous abbreviated form.  Here is one experiment to\nshow what I mean:\n\n    $ TZ=KST date\n    Tue Apr  2 00:29:51 KST 2019\n    $ TZ=JST date\n    Tue Apr  2 00:29:51 JST 2019\n    $ TZ=Asia/Tokyo date\n    Tue Apr  2 09:29:51 JST 2019\n\nTwo points to be learned from the above exercise are:\n\n - It is not limited to your copy of \"git\".  Even a system supplied\n   command like \"date\" does not work with \"JST\" but it can grok\n   Asia/Tokyo just fine (\"JST\" does not necessarily have to be\n   \"Japan standard time\"; it could be Jamaican ;-)).\n\n - It is not limited to KST (is that Kabul standard time?  Khartoum?\n   Kinshasa?).\n\nPerhaps try TZ=Asia/Seoul or something?\n"},{"id":"372983","messageId":"CAP5K-1YC=2gW1Wd37Ggp-XpRzhpTVysV2QYdtKOLtQbFY=i3mw@mail.gmail.com","threadId":"50858","inReplyTo":"xmqq7ecdutq2.fsf@gitster-ct.c.googlers.com","subject":"Re: [Bug] git log - reports wrong date and time","fromName":"Chanseok Oh","fromEmail":"chanseok@google.com","sentAt":"2019-04-02T14:59:58Z","receivedAt":"2019-04-02T15:00:38Z","isPatch":false,"sender":{"key":"chanseok@google.com","avatar":null},"body":"Turns out I wasn't using TZ in the right way. One of the formats for\nTZ is std offset, where std string specifies the name of the time zone\n(such as EDT, PDT, KST, or JST) and offset is the time that should be\nadded to get UTC. In this format, you specify the time zone\ninformation directly, which means, it is your responsibility to\nspecify the correct time zone information. Below demonstrates how this\nformat works:\n\n$ TZ=UTS-3 date\n\n$ TZ=KST-7:30 date\n\n$ TZ=JST+12:22:12 date\n\nThanks for you response anyway, and sorry for the noise.\n\n\nOn Mon, Apr 1, 2019 at 8:38 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Chanseok Oh <chanseok@google.com> writes:\n>\n> > BROKEN: anything other than UTC reports wrong date.\n> >\n> >     $ TZ=KST git log '--date=format-local:%Y%m%d %H%M%S %z (%Z)'\n> > --format=%cd -n1\n> >     20190401 210250 +0000 (KST)\n>\n> I think you are probably on a system where timezones can be given\n> only with a more modern and unambiguous style and not in the\n> potentially ambiguous abbreviated form.  Here is one experiment to\n> show what I mean:\n>\n>     $ TZ=KST date\n>     Tue Apr  2 00:29:51 KST 2019\n>     $ TZ=JST date\n>     Tue Apr  2 00:29:51 JST 2019\n>     $ TZ=Asia/Tokyo date\n>     Tue Apr  2 09:29:51 JST 2019\n>\n> Two points to be learned from the above exercise are:\n>\n>  - It is not limited to your copy of \"git\".  Even a system supplied\n>    command like \"date\" does not work with \"JST\" but it can grok\n>    Asia/Tokyo just fine (\"JST\" does not necessarily have to be\n>    \"Japan standard time\"; it could be Jamaican ;-)).\n>\n>  - It is not limited to KST (is that Kabul standard time?  Khartoum?\n>    Kinshasa?).\n>\n> Perhaps try TZ=Asia/Seoul or something?\n"}]}