TimeAgo

Simple java library for displaying dates as relative time ago language.

License

License

GroupId

GroupId

com.github.marlonlom
ArtifactId

ArtifactId

timeago
Last Version

Last Version

4.0.3
Release Date

Release Date

Type

Type

aar
Description

Description

TimeAgo
Simple java library for displaying dates as relative time ago language.
Project URL

Project URL

https://github.com/marlonlom/timeago
Source Code Management

Source Code Management

https://github.com/marlonlom/timeago

Download timeago

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.marlonlom/timeago/ -->
<dependency>
    <groupId>com.github.marlonlom</groupId>
    <artifactId>timeago</artifactId>
    <version>4.0.3</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.marlonlom/timeago/
implementation 'com.github.marlonlom:timeago:4.0.3'
// https://jarcasting.com/artifacts/com.github.marlonlom/timeago/
implementation ("com.github.marlonlom:timeago:4.0.3")
'com.github.marlonlom:timeago:aar:4.0.3'
<dependency org="com.github.marlonlom" name="timeago" rev="4.0.3">
  <artifact name="timeago" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.github.marlonlom', module='timeago', version='4.0.3')
)
libraryDependencies += "com.github.marlonlom" % "timeago" % "4.0.3"
[com.github.marlonlom/timeago "4.0.3"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

TimeAgo

Maven Central Android Arsenal Download Build Status

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:

<dependency>
  <groupId>com.github.marlonlom</groupId>
  <artifactId>timeago</artifactId>
  <version>$latestVersion</version>
</dependency>

Use it in your code:

String text = TimeAgo.using(timeInMillis);

Where timeInMillis, based on current date and time, is defined like

/* 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:

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 here.

Spread the word

If you like this library, please tell others about it ๐Ÿ‘ ๐Ÿ‘

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.

Versions

Version
4.0.3
4.0.1
4.0.0
3.0.2
3.0.1
3.0.0
2.1.0
2.0.0
1.0.0