Intelligent date / time parser for Java

datetime, java

Solution

JodaTime is excellent for manipulating date objects (e.g. date.plusDays(10))

...but JChronic is what you want for natural language date parsing, e.g.

Chronic.parse("now")
Chronic.parse("tomorrow 15:00")
Chronic.parse("14/2/2001")
Chronic.parse("yesterday")
Chronic.parse("20 Jan 2010")

Your question is similar to this one.

Problem

Is there some intelligent date / time parser library for Java? By intelligent I mean, that I don't need to specify the date / time format. The API should be similar to this: ``` Calendar cal = DateTimeParser.parse("01/06/10 14:55"); cal = DateTimeParser.parse("1 Jan 2009"); // assumes 00:00 time cal = DateTimeParser.parse("1.2.2010"); cal = DateTimeParser.parse("kygyutrtf"); // throws exception ``` UPDATE: ``` // I'm telling the parser: "If unsure, assume US date format" cal = DateTimeParser.parse("01/02/03", new Locale("en-us")); ```

Original source

Related problems