git: timezone and timestamp format

后端 未结 8 620
遥遥无期
遥遥无期 2020-12-01 08:42

From git I can get the timestamp:

\"2011-10-04 12:58:36 -0600\"

but is there any way to show it as:

\"2011-10-04 06:58:36\"         


        
相关标签:
8条回答
  • 2020-12-01 09:37

    Unfortunately, using git log --date=local as explained in previous answers changes the output format.

    To keep the format as asked (YYYY-MM-DD HH:mm) I had to use:

    git log --date=iso-local
    

    But that only works on git 2.7 or above.

    0 讨论(0)
  • 2020-12-01 09:37

    To get the format (YYYY-MM-DD HH:hh), you can use:

    git log --date=format:%Y-%m-%d\ %H:%M
    

    Works beautifully with Git Standup too: https://github.com/kamranahmedse/git-standup

    0 讨论(0)
提交回复
热议问题