Parsing an ISO 8601 date in Java8 when all fields (including separators, but not including years) are optional

前端 未结 4 1710
北海茫月
北海茫月 2021-01-15 06:26

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
4条回答
  •  不要未来只要你来
    2021-01-15 06:48

    create a lookup table of DateFormatters or whatever you're using based on the length of the input String and the occurrence of 'T'

提交回复
热议问题