Generic way to parse dates in Java

后端 未结 7 956
醉酒成梦
醉酒成梦 2021-01-19 00:03

What is the best way to parse dates in Java ? Is there any built in way to parse strings such as \"18 Jul 2011\" , \"Jul 18, 2011\", \"18-07-2011\", \"2011-07-18\" without k

7条回答
  •  我在风中等你
    2021-01-19 00:38

    This is a large issue, mostly because dates are a fuzzy concept - for example is 02-01-2012 in February or January?

    The best you can do is collect a bunch of different format strings and try each one until you get a match...

提交回复
热议问题