Time Ago

Simple Java library for converting dates to time ago strings.

License

License

GroupId

GroupId

com.github.kevinsawicki
ArtifactId

ArtifactId

timeago
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Time Ago
Simple Java library for converting dates to time ago strings.
Project URL

Project URL

http://www.github.com/kevinsawicki/java-timeago
Source Code Management

Source Code Management

https://github.com/kevinsawicki/java-timeago

Download timeago

How to add to project

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

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.8

Project Modules

There are no modules declared in this project.

#Java timeago library

This is a Java port of the jquery-timeago plug-in. Please visit the jquery-timeago project page to read more about fuzzy timestamps.

##Building

The timeago project contains a Maven pom.xml file that builds a jar containing the TimeAgo class.

To build and run the included unit tests:

$ mvn clean install

##Usage

TimeAgo time = new TimeAgo();
long current = System.currentTimeMillis();
String minutes = time.timeAgo(current - (15 * 60 * 1000));	// returns "15 minutes ago"
String hours = time.timeUntil(current - (6 * 60 * 60 * 1000));	// returns "6 hours from now"

Maven

This library is available from Maven Central.

<dependency>
  <groupId>com.github.kevinsawicki</groupId>
  <artifactId>timeago</artifactId>
  <version>1.0.1</version>
</dependency>

##Contribution

If you would like to contribute locale-specific properties files please fork this repository and open a pull request.

##Other

MIT License

Versions

Version
1.0.1
1.0.0