Home

Awesome

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

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

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!