4

What date formats does git log accept for the --before, --after, --since, and --until options (as opposed to the --date option)?

I'm interested in getting logs for date ranges in the local time zone.

rakslice
  • 8,742
  • 4
  • 53
  • 57
  • 1
    Unix epoch time (seconds since 0:00 Jan 1 1970 UTC) appears to be supported. Some more info: http://alexpeattie.com/blog/working-with-dates-in-git/#date-parsing-with-approxidate – rakslice Aug 02 '14 at 01:07
  • Consider using `git log --date=local` also. – Matt Johnson-Pint Aug 02 '14 at 01:14
  • See also http://stackoverflow.com/a/24977895/6309 – VonC Aug 02 '14 at 04:35
  • See also the table under format in [git log documentation](https://www.kernel.org/pub/software/scm/git/docs/git-log.html) (search for "format-string" or "placeholders"), as well as [How to change Git log date formats](https://stackoverflow.com/questions/7853332/how-to-change-git-log-date-formats) – Joshua Goldberg Dec 15 '22 at 19:06

1 Answers1

6

According to the documentation these formats are accepted:

  • Git internal format:: It is <unix timestamp> <time zone offset>, where <unix timestamp> is the number of seconds since the UNIX epoch. <time zone offset> is a positive or negative offset from UTC. For example CET (which is 2 hours ahead UTC) is +0200.

  • RFC 2822:: The standard email format as described by RFC 2822, for example Thu, 07 Apr 2005 22:13:13 +0200.

  • ISO 8601:: Time and date specified by the ISO 8601 standard, for example 2005-04-07T22:13:13. The parser accepts a space instead of the T character as well.

  • + NOTE: In addition, the date part is accepted in the following formats: YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY.

Gergo Erdosi
  • 40,904
  • 21
  • 118
  • 94