Question

In JGit, how to get timezone of a commit? Current RevCommit class does not have anything about timezone. It only returns UTC unix time

Was it helpful?

Solution

Use the PersonIdent:

RevCommit commit = ...;
PersonIdent committerIdent = commit.getCommitterIdent();
if (committerIdent != null) {
    TimeZone timeZone = committerIdent.getTimeZone(); // or getTimeZoneOffset()
}

There is also getAuthorIdent() which is the same for author.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top