Human readable datetime formatting for Java.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE
README.md
pom.xml

README.md

htime

A Java library to make it easy for humans format a date. You no longer need to remember date time formatting chars: just write an example, and you will get the appropriate formatter.

The project follows the Semantic Versioning Convention and uses Apache 2.0 license.

Flattr this! Build Status

Project stats by OpenHub

Download

htime is available on Maven central repository.

<dependency>
    <groupId>com.cronutils</groupId>
    <artifactId>htime</artifactId>
    <version>1.0.0</version>
</dependency>

Features

  • Provide any date time format written in human readable text, and get the appropriate date time formatter!

Usage Examples

Get JDK SimpleDateFormatter

//define your own expressions to be formatted
HDateTimeFormat hDateTimeFormat =
        HDateTimeFormatBuilder.getInstance().forJDK12().getFormatter();
SimpleDateFormat jdkTimeFormatter = hDateTimeFormat.forPattern("June 9, 2011");
String formattedDate = jdkTimeFormatter.format(new Date());
//formattedDate will be ex.: "June 9, 2015"

Get JodaTime DateTimeFormatter

//define your own expressions to be formatted
HDateTimeFormat hDateTimeFormat =
        HDateTimeFormatBuilder.getInstance().forJodaTime().getFormatter();
DateTimeFormatter jodaTimeFormatter = hDateTimeFormat.forPattern("June 9, 2011");
String formattedDate = jodaTimeFormatter.print(DateTime.now());
//formattedDate will be ex.: "June 9, 2015"

Contribute & Support!

Contributions are welcome! You can contribute by

  • star and/or Flattr this repo!
  • requesting or adding new features. Check our roadmap!
  • enhancing existing code: ex.: provide more accurate description cases
  • testing
  • enhancing documentation
  • providing translations to support new locales
  • bringing suggestions and reporting bugs
  • spreading the word / telling us how you use it!

Check our page! For stats about the project, you can visit our OpenHUB profile.

Support us donating once or by subscription through Flattr!

Flattr this!