Class RelativeDateFormatter

java.lang.Object
org.eclipse.jgit.util.RelativeDateFormatter

public class RelativeDateFormatter extends Object
Formatter to format timestamps relative to the current time using time units in the format defined by git log --relative-date.
  • Field Details

  • Constructor Details

    • RelativeDateFormatter

      public RelativeDateFormatter()
  • Method Details

    • format

      public static String format(Date when)
      Get age of given Date compared to now formatted in the same relative format as returned by git log --relative-date
      Parameters:
      when - Date to format
      Returns:
      age of given Date compared to now formatted in the same relative format as returned by git log --relative-date
    • upperLimit

      private static long upperLimit(long unit)
    • round

      private static long round(long n, long unit)