Search code examples
javaandroidjakarta-eeprettytime

Parsing ill-formated date-time string in Java


In one sentence: Should I be able to parse "04 Dec 2014 pm 1:58" by PrettyTime?

Descriptive: I am in need to parse & get proper date format from some ill formatted date-time string. e.g. "04 Dec 2014 pm 1:58". When I do parse this example string, I get : "Thu Dec 04 02:59:33 ALMT 2014" which is I believe my current time stamp.

Consideration: if I had only this single ill-format, I could write my SimpleDateFormat. But there can a good varieties of formatting which are mostly going to be ill-formatted.

Can any of you kindly tell me, whether should I expect PrettyTime to parse for this type of ill-formatted string? Or could you please point to any Java library which can handle these type of ill formatted date strings in Java?


Solution

  • Apparently, after days of various attempts, my finding is PrettyTime is not capable to do so though it handles pretty good NLP date & time related stuffs. Finally I ended up with various SimpleDateFormat . Not the best solution rather a temporary solution. If anyone stumble upon this thread, please share your experiences.