Parsing an ISO 8601 date in Java8 when all fields (including separators, but not including years) are optional
问题 I have a requirement for parsing ISO8601 formatted strings in Java with various levels of accuracy. Some examples of the string I need to parse are: 2018 2018-10 2018-10-15 2018-10-15T12:00 2018-10-15T12:00:30 2018-10-15T12:00:30.123 20181015 201810151200 20181015120030 20181015120030.123 20181015T12:00:30.123 Where I don't have a field then I am free to assume the lowest valid value that applies (for example, if the month is missing I can assume January, if the day is missing then assume the