14

RevCommit has a getCommitTime() method but it returns an int and it does not have an author time. How can I get the author and commit date from a RevCommit?

Nathan
  • 8,093
  • 8
  • 50
  • 76
Coder
  • 1,375
  • 2
  • 20
  • 45

1 Answers1

29

Like so:

RevCommit commit = ...;

PersonIdent authorIdent = commit.getAuthorIdent();
Date authorDate = authorIdent.getWhen();
TimeZone authorTimeZone = authorIdent.getTimeZone();

PersonIdent committerIdent = commit.getCommitterIdent();
...

Also see API documentation.

robinst
  • 30,027
  • 10
  • 102
  • 108