# git log use of date format differs between Command Line and script usage.

4 messages from 2017-06-30 to 2017-06-30. Participants: Shaun Uldrikis, René Scharfe, Stefan Beller.
Thread: https://gitlist.dev/t/46297

## Shaun Uldrikis, 2017-06-30 16:06

Subject: git log use of date format differs between Command Line and script usage.
Message-ID: <CADHEqX_fiUhnpn6WAFrbDaNJTb1Vbom7Ndn-n6WmQ0gkQ69ZeA@mail.gmail.com>
URL: https://gitlist.dev/e/CADHEqX_fiUhnpn6WAFrbDaNJTb1Vbom7Ndn-n6WmQ0gkQ69ZeA%40mail.gmail.com

```
If you supply a non-standard format to the date configuration for git
log, something like:
[log]
        date = format:%Y-%m-%d %H:%M

then, when you run 'git log' inside a script, or when using gitk
(anywhere), it fails on decoding the format.

fatal: unknown date format format: %Y-%m-%d %H:%M


However, that format works correctly on the command line.
I do not have a patch to address this issue.

-Shaun

```

## René Scharfe, 2017-06-30 16:41

Subject: Re: git log use of date format differs between Command Line and script usage.
Message-ID: <7e7c7d22-36e2-20f4-0cfc-8cfe37d9a409@web.de>
URL: https://gitlist.dev/e/7e7c7d22-36e2-20f4-0cfc-8cfe37d9a409%40web.de
In-Reply-To: <CADHEqX_fiUhnpn6WAFrbDaNJTb1Vbom7Ndn-n6WmQ0gkQ69ZeA@mail.gmail.com>

```
Am 30.06.2017 um 18:06 schrieb Shaun Uldrikis:
> If you supply a non-standard format to the date configuration for git
> log, something like:
> [log]
>          date = format:%Y-%m-%d %H:%M
> 
> then, when you run 'git log' inside a script, or when using gitk
> (anywhere), it fails on decoding the format.
> 
> fatal: unknown date format format: %Y-%m-%d %H:%M
> 
> 
> However, that format works correctly on the command line.
> I do not have a patch to address this issue.

I guess you have two versions of git on your system, and the one used in
scripts is older than 2.6.0, which introduced this feature.

René

```

## Stefan Beller, 2017-06-30 16:43

Subject: Re: git log use of date format differs between Command Line and script usage.
Message-ID: <CAGZ79kZxde9j+O4JDofYLbC2CRk_X0tiwOftEgKQcJLyN409xQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAGZ79kZxde9j%2BO4JDofYLbC2CRk_X0tiwOftEgKQcJLyN409xQ%40mail.gmail.com
In-Reply-To: <CADHEqX_fiUhnpn6WAFrbDaNJTb1Vbom7Ndn-n6WmQ0gkQ69ZeA@mail.gmail.com>

```
On Fri, Jun 30, 2017 at 9:06 AM, Shaun Uldrikis <stuldrikis@gmail.com> wrote:
> If you supply a non-standard format to the date configuration for git
> log, something like:
> [log]
>         date = format:%Y-%m-%d %H:%M

So I ran

    $ git config log.date  "format:%Y-%m-%d %H:%M"
    $ git config --list |grep log.date
    log.date=format:%Y-%m-%d %H:%M

Then I have a script as
  $ cat script.sh
  #!/bin/sh

  git log >out

after executing I get:

  $ head out
  commit 7930db48ca31b41ac335ae8cd25cb29094d1de5e
  Author: Stefan Beller <sbeller@google.com>
  Date:   2017-06-30 09:26

Also gitk seems to work here.

Rene's answer sounds reasonable,
check the version(s) of Git on your system?

```

## Shaun Uldrikis, 2017-06-30 17:29

Subject: Re: git log use of date format differs between Command Line and script usage.
Message-ID: <CADHEqX9-w5uZpS1RiP9EjCpWB0V1SVYZ5Ddsv3etCvBteOv4qg@mail.gmail.com>
URL: https://gitlist.dev/e/CADHEqX9-w5uZpS1RiP9EjCpWB0V1SVYZ5Ddsv3etCvBteOv4qg%40mail.gmail.com
In-Reply-To: <CAGZ79kZxde9j+O4JDofYLbC2CRk_X0tiwOftEgKQcJLyN409xQ@mail.gmail.com>

```
Yes. That is the case. Just confirmed it. I'll remove the old version.
Sorry to have bothered the mailing list.

Thank you.

-Shaun

On Fri, Jun 30, 2017 at 12:43 PM, Stefan Beller <sbeller@google.com> wrote:
> On Fri, Jun 30, 2017 at 9:06 AM, Shaun Uldrikis <stuldrikis@gmail.com> wrote:
>> If you supply a non-standard format to the date configuration for git
>> log, something like:
>> [log]
>>         date = format:%Y-%m-%d %H:%M
>
> So I ran
>
>     $ git config log.date  "format:%Y-%m-%d %H:%M"
>     $ git config --list |grep log.date
>     log.date=format:%Y-%m-%d %H:%M
>
> Then I have a script as
>   $ cat script.sh
>   #!/bin/sh
>
>   git log >out
>
> after executing I get:
>
>   $ head out
>   commit 7930db48ca31b41ac335ae8cd25cb29094d1de5e
>   Author: Stefan Beller <sbeller@google.com>
>   Date:   2017-06-30 09:26
>
> Also gitk seems to work here.
>
> Rene's answer sounds reasonable,
> check the version(s) of Git on your system?

```
