public class RelativeDateFormatter
extends java.lang.Object
git log --relative-date
.Modifier and Type | Field and Description |
---|---|
(package private) static long |
DAY_IN_MILLIS |
(package private) static long |
HOUR_IN_MILLIS |
(package private) static long |
MINUTE_IN_MILLIS |
(package private) static long |
MONTH_IN_MILLIS |
(package private) static long |
SECOND_IN_MILLIS |
(package private) static long |
WEEK_IN_MILLIS |
(package private) static long |
YEAR_IN_MILLIS |
Constructor and Description |
---|
RelativeDateFormatter() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
format(java.util.Date when)
Get age of given
Date compared to now formatted in the
same relative format as returned by git log --relative-date |
private static long |
round(long n,
long unit) |
private static long |
upperLimit(long unit) |
static final long SECOND_IN_MILLIS
static final long MINUTE_IN_MILLIS
static final long HOUR_IN_MILLIS
static final long DAY_IN_MILLIS
static final long WEEK_IN_MILLIS
static final long MONTH_IN_MILLIS
static final long YEAR_IN_MILLIS
public static java.lang.String format(java.util.Date when)
Date
compared to now formatted in the
same relative format as returned by git log --relative-date
when
- Date
to formatDate
compared to now formatted in
the same relative format as returned by
git log --relative-date
private static long upperLimit(long unit)
private static long round(long n, long unit)