Skip to content

jmrozanec/htime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Human readable datetime formatting for Java.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages