All Projects → kevinsawicki → java-timeago

kevinsawicki / java-timeago

Licence: other
Java timeago library

Programming Languages

java
68154 projects - #9 most used programming language

#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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].