TimeAgo
显示时间前语句的简单java库。
Examples:
4 days ago
15 years ago
a minute ago
just now
Usage:
导入依赖:
Gradle:
compile 'com.github.marlonlom:timeago:$latestVersion'
Maven:
com.github.marlonlom
timeago
$latestVersion
默认使用方法:
/** using java.util.Date*/
TimeAgo.from(new java.util.Date().getTime());
/** using java.util.Calendar*/
TimeAgo.from(java.util.Calendar.getInstance().getTime().getTime());
With Specific Locale (by language tag):
语言支持: Spanish (es), English (en), German (de), French (fr), Italian (it), Portuguese (pt).
Locale LocaleBylanguageTag = Locale.forLanguageTag("es");
TimeAgoMessages messages = new TimeAgoMessages.Builder().withLocale(LocaleBylanguageTag).build();
TimeAgo.from(new java.util.Date().getTime(), messages);