public class TimeAgo extends Object
Modifier and Type | Field and Description |
---|---|
private static long |
DAY |
private static long |
HOUR |
private static long |
MINUTE |
private static long |
MONTH |
private static long |
SECOND |
private static long |
YEAR |
Constructor and Description |
---|
TimeAgo() |
Modifier and Type | Method and Description |
---|---|
static String |
getTimeAgo(long now,
long timestamp)
Returns an expression in "x days ago" or "now"
Could be improved: if we say 1 year ago, no need to say "1 year 7 seconds ago"...
|
private static List<String> |
getTimeAgoList(long now,
long timestamp) |
private static long |
reduce(List<String> result,
long lapseMillis,
long duration,
String textSingular,
String textPlural) |
private static final long SECOND
private static final long MINUTE
private static final long HOUR
private static final long DAY
private static final long MONTH
private static final long YEAR
public static String getTimeAgo(long now, long timestamp)
Copyright © 2021 Play SQL. All rights reserved.