Possible Duplicate:
generically parsing String to date
Following situation:
I need to detect if a String contains a DateTime/Timestamp. The problem is that those DateTimes come in various formats and granularity such as:
2011-09-12
12-09-2011
12.09.2011
2011-09-01-14:15
… and many many more variations
I don’t need to understand the semantics (e.g. distinct between day or months) I just need to detect let’s say 80% of the most common DateTime variations.
My first thought was using RegExp – which I’m far from being familiar with and also I would need to familiarize myselft with all variations in which DateTimes can come.
So my questions:
- Does anybody know a canned RegExps to achieve this?
- Is there maybe some Java library that could do this task?
Thanks!!
There is another question of same context, hope that link will help you: Dynamic regex for date time formats