Thread (12 messages) 12 messages, 5 authors, 2025-09-24

Re: 0-Based indexes for git log

From: Jeff King <hidden>
Date: 2025-09-24 05:22:17

On Tue, Sep 23, 2025 at 05:15:46PM -0400, 𝕍𝕖𝕝𝕠𝕔𝕚𝕗𝕪𝕖𝕣 wrote:
In git log it uses a 1-based index for the date instead of a 0 based index.
So it says "Fri Sep 19 14:23:24 2025 -0400" when it should say "Fri Sep 18
14:23:24 2025 -0400"
Are you proposing that the first day of September is the 0th? You might
be able to do that with locale support and using strftime's %c option,
but I'm not sure how powerful locales are (or how one even defines
them).
(or "Friday 2025-8-18 14:23:24 (-4:00.00)"  to get a
better format)
If you just care about the format, check out the --date option in
git-log's manpage. Especially the "format:" specifier, which relies on
strftime, like:

  git log --date=format:'%A %Y-%m-%d %H:%M:%S (%z)'

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help