How to get the given date string format(pattern) in java?

后端 未结 10 1692
抹茶落季
抹茶落季 2020-11-30 04:41

I want to get the format of a given date string.

Example: I have a string like 2011-09-27T07:04:21.97-05:00 and the date format of this string is

10条回答
  •  难免孤独
    2020-11-30 05:10

    Madhu's code is can workout, but some performance problem will arise because every failure case will raise the exception. i think we need to find the reguler expression solution to find the pattern form the given date String.

    you can find all most all reg expressions to date and time format in the following link

    http://regexlib.com/DisplayPatterns.aspx?cattabindex=4&categoryId=5&AspxAutoDetectCookieSupport=1

提交回复
热议问题