Skip to content
/ anytime Public

Parse time in almost any widely used format into Instant

License

Notifications You must be signed in to change notification settings

mjcro/anytime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Any Time

Java8 GitHub Snyk Vulnerabilities for GitHub Repo CircleCI

Parse time in almost any widely used format into Instant using regexps and DateTimeFormatter.

Distribution

<dependency>
    <groupId>io.github.mjcro</groupId>
    <artifactId>anytime</artifactId>
    <version>1.0.3</version>
</dependency>

Goal

  • 🎉 Provide simple way to parse commonly used date/time representations in APIs and clearing files into Instant
  • 🔀 Controversial formats like d/m/y and m/d/y should be solved by providing corresponding locale.
  • 💡 Provide simple way to convert misc Java date/time representations into Instant

Not a goal

  • ⚗️ Parse anything using natural language date parser. To do this use Natty
  • 🧪 Parse anything using retree. To do this use dateparser

Supported formats (at least):

  • Integer unix seconds
  • Integer unix milliseconds
  • Float unix seconds
  • yyyy-mm-dd
  • yyyy/mm/dd
  • yyyy.mm.dd
  • dd-mm-yyyy (locale dependent)
  • dd/mm/yyyy (locale dependent)
  • dd.mm.yyyy (locale dependent)
  • mm-dd-yyyy (locale dependent)
  • mm/dd/yyyy (locale dependent)
  • mm.dd.yyyy (locale dependent)
  • m-d-yyyy (locale dependent)
  • m.d.yyyy (locale dependent)
  • m/d/yyyy (locale dependent)
  • m-d-yy (locale dependent)
  • m.d.yy (locale dependent)
  • m/d/yy (locale dependent)
  • d-m-yyyy (locale dependent)
  • d.m.yyyy (locale dependent)
  • d/m/yyyy (locale dependent)
  • d-m-yy (locale dependent)
  • d.m.yy (locale dependent)
  • d/m/yy (locale dependent)
  • yyyy-mm-ddThh:mm:ss-03:00 (ISO 8601)
  • yyyy-mm-ddThh:mm:ssZ (ISO 8601)
  • yyyy-mm-ddThh:mm-03:00 (ISO 8601)
  • yyyy-mm-ddThh:mmZ (ISO 8601)
  • yyyy-mm-ddThh-03:00 (ISO 8601)
  • yyyy-mm-ddThhZ (ISO 8601)
  • yyyy-mm-dd hh:mm:ss+02:00 (RFC 3339)
  • yyyy-mm-dd hh:mm:ssZ (RFC 3339)
  • yyyy-mm-dd hh:mm+02:00 (RFC 3339)
  • yyyy-mm-dd hh:mmZ (RFC 3339)
  • yyyy-mm-dd hh+02:00 (RFC 3339)
  • yyyy-mm-dd hhZ (RFC 3339)
  • EEE MMM dd HH:mm:ss X yyyy

About

Parse time in almost any widely used format into Instant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages