# TimeAgo
[![Maven Central](https://img.shields.io/maven-central/v/com.github.marlonlom/timeago.svg)](http://www.mvnrepository.com/artifact/com.github.marlonlom/timeago)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Timeago-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/4707)
[![Download](https://api.bintray.com/packages/marlonlom/timeago/timeago/images/download.svg) ](https://bintray.com/marlonlom/timeago/timeago/_latestVersion)
[![Build Status](https://travis-ci.org/marlonlom/timeago.svg?branch=master)](https://travis-ci.org/marlonlom/timeago)
<a href="http://www.methodscount.com/?lib=com.github.marlonlom%3Atimeago%3A%2B"><img src="https://img.shields.io/badge/Methods and size-97 | 32 KB-e91e63.svg"/></a>
Simple java library for displaying dates as relative time ago language.
## Examples:
- 4 days ago
- 15 years ago
- a minute ago
- just now
## Usage:
### Import as a dependency:
Gradle:
```
compile 'com.github.marlonlom:timeago:$latestVersion'
```
Maven:
```xml
<dependency>
<groupId>com.github.marlonlom</groupId>
<artifactId>timeago</artifactId>
<version>$latestVersion</version>
</dependency>
```
### Use it in your code:
```java
String text = TimeAgo.using(timeInMillis);
```
Where _timeInMillis_, based on current date and time, is defined like
```java
/* You can use java.util.Calendar.getInstance().getTimeInMillis()*/
/* Also, with java 8, java.time.Instant.now().toEpochMilli() */
long timeInMillis = System.currentTimeMillis();
```
### With Specific Locale (by language tag):
For specific language usage, use _TimeAgoMessages_:
```java
Locale LocaleBylanguageTag = Locale.forLanguageTag("es");
TimeAgoMessages messages = new TimeAgoMessages.Builder().withLocale(LocaleBylanguageTag).build();
String text = TimeAgo.using(timeInMillis, messages);
```
Languages supported: Spanish (es), English (en), Dutch (nl), German (de), French (fr), Italian (it), Portuguese (pt), Indonesian (id), Czech (cs), Arabic (ar).
## Demo
Check the [Demo](https://goo.gl/y66vh4) here.
## Spread the word
If you like this library, please tell others about it :thumbsup::thumbsup:
<a href="https://twitter.com/intent/tweet?text=Trying%20to%20show%20relative%20date%20time%20texts%3F%20Check%20out%20this%20awesome%20library%20on%20Github%3A%20https://github.com/marlonlom/timeago" target="_blank" title="share to twitter" style="width:100%"><img src="https://github.com/marlonlom/staticmaps_builder/blob/master/design/twitter_icon.png" title="Share on Twitter" width="35" height=35 />
<a href="https://plus.google.com/share?url=https://github.com/marlonlom/timeago" target="_blank" title="share to G+" style="width:100%"><img src="https://github.com/marlonlom/staticmaps_builder/blob/master/design/googleplus_icon.png" target="_blank" title="Share on Google+" width="35" height=35 />
<a href="https://www.facebook.com/sharer/sharer.php?u=https://github.com/marlonlom/timeago" target="_blank" title="share to facebook" style="width:100%"><img src="https://github.com/marlonlom/staticmaps_builder/blob/master/design/facebook_icon.png" title="Share on Facebook" width="35" height=35 />
- []()Follow me on **Twitter**: [**@Marlonlom**](https://twitter.com/marlonlom)
- Contact me on **LinkedIn**: [**Marlonlom**](https://co.linkedin.com/in/marlonlom)
### License
```
Copyright 2016 marlonlom
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
没有合适的资源?快使用搜索试试~ 我知道了~
Simple java library for displaying dates as relative time .zip
共79个文件
properties:21个
xml:18个
kt:13个
需积分: 5 0 下载量 48 浏览量
2024-02-04
10:14:52
上传
评论
收藏 179KB ZIP 举报
温馨提示
Simple java library for displaying dates as relative time
资源推荐
资源详情
资源评论
收起资源包目录
Simple java library for displaying dates as relative time .zip (79个子文件)
ahao11111
gradle.properties 1KB
gradle
wrapper
gradle-wrapper.jar 52KB
gradle-wrapper.properties 232B
.travis.yml 935B
LICENSE.txt 11KB
gradlew.bat 2KB
build.gradle 1KB
ta_screenshots
2016-11-19 00-04-00 Screenshot.jpg 21KB
.idea
jarRepositories.xml 1KB
codeStyles
Project.xml 3KB
runConfigurations.xml 564B
vcs.xml 167B
caches
build_file_checksums.ser 596B
misc.xml 357B
compiler.xml 230B
modules.xml 653B
gradle.xml 858B
settings.gradle 635B
gradlew 5KB
ta_sample
src
main
java
com
github
marlonlom
timeago
sample
utils
CalendarSampleDataUtil.kt 8KB
ui
MainTabsActivity.kt 7KB
res
mipmap-xxhdpi
ic_launcher_round.webp 7KB
ic_launcher.webp 5KB
mipmap-hdpi
ic_launcher_round.webp 3KB
ic_launcher.webp 3KB
menu
menu_tabbed_main.xml 1KB
menu_main_tabs.xml 1KB
mipmap-mdpi
ic_launcher_round.webp 2KB
ic_launcher.webp 2KB
mipmap-xxxhdpi
ic_launcher_round.webp 10KB
ic_launcher.webp 7KB
mipmap-xhdpi
ic_launcher_round.webp 4KB
ic_launcher.webp 3KB
values-w820dp
dimens.xml 975B
values
dimens.xml 919B
colors.xml 824B
strings.xml 2KB
styles.xml 1KB
layout
activity_main_tabs.xml 2KB
fragment_main_tabs.xml 1KB
AndroidManifest.xml 2KB
proguard-rules.pro 954B
build.gradle 2KB
.gitignore 7B
.gitignore 2KB
README.md 4KB
HEADER.txt 551B
ta_library
src
test
java
com
github
marlonlom
utilities
timeago
TimeAgoTestsSuite.kt 567B
DataBuilder.kt 2KB
usages
WeeksAgoTest.kt 5KB
DaysAgoTest.kt 4KB
MinutesAgoTest.kt 4KB
HoursAgoTest.kt 4KB
NowAgoTest.kt 3KB
MonthsAgoTest.kt 4KB
YearsAgoTest.kt 5KB
main
resources
com
github
marlonlom
utilities
timeago
messages_hu.properties 2KB
messages_de.properties 2KB
messages_hi.properties 2KB
messages_fa.properties 2KB
messages_zh_TW.properties 2KB
messages_da.properties 2KB
messages_it.properties 2KB
messages_zh.properties 2KB
messages_in.properties 1KB
messages_pt.properties 2KB
messages_en.properties 2KB
messages_ar.properties 2KB
messages_cs.properties 2KB
messages_es.properties 2KB
messages_nl.properties 2KB
messages_fr.properties 2KB
messages_eu.properties 2KB
messages.properties 2KB
messages_tr.properties 2KB
java
com
github
marlonlom
utilities
timeago
TimeAgoMessages.kt 3KB
TimeAgo.kt 16KB
build.gradle 1KB
.gitignore 7B
共 79 条
- 1
资源评论
码农阿豪
- 粉丝: 1w+
- 资源: 1750
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功