Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 JGit 中,如何获取提交的时区?当前的 RevCommit 类没有任何关于时区的信息。它只返回 UTC unix 时间
使用 PersonIdent:
RevCommit commit = ...; PersonIdent committerIdent = commit.getCommitterIdent(); if (committerIdent != null) { TimeZone timeZone = committerIdent.getTimeZone(); // or getTimeZoneOffset() }
也有getAuthorIdent()与作者相同的。
getAuthorIdent()