开发者

Returning a date format from an unknown format of date string in java [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Parse any date in Java

Suppose we have a string of date in a format (unknown to the user). Examples of acceptable dates that you can receive from a user:

  • yyyy-MM-dd/yy-MM-dd
  • yyyy/MM/dd/yy/MM/dd
  • dd/MM/yyyy/dd/MM/yy
  • MM/dd/yyyy/MM/dd/yy`

Is there a libr开发者_StackOverflowary that accept a date in a string and returns a date format that can be used by SimpleDateFormat or Joda Time?

Thanks


As a simple solution: I will apply each date format on the provided input to get a Date object , then I print the Date object with the same date format. If the input and the output for a date format are the same the date format is a candidate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜