I am involved in a project that requires me to parse strings into dates. The dates that we get are not in any single well-defined format.
Example: Variable spaces in between date fields, both single digit and multiple digit date fields, missing date fields like missing time or optionally present milliseconds or zone offset etc.
By Date Fields I mean: Day, Month, Year, Hour, Minutes, Seconds, Milliseconds, zone offset, time zone etc.
Some sample inputs:
"2014 :11 :01 00 :49"
"2015-08-25T00:02:40Z"
"2016/6/2 19:16:29"
"2017:10:27 18 :08: 9"
"2016-04-29T16:10:48 .80+00:00"
"2017:02:11 9:26:16 a. m."
"2017-12-16T08:04:17####"
I decided to use the DateTimeFormatter
builder to create the formatter with multiple date patterns.
I was wondering if there is any easy simpler way or a library that does similar fuzzy matching/parsing of strings to Date.