- How to find a String contains fully on date formats, not an check with single date format, I want to check string with various formats?
- If a string matches with various formats means return boolean value.
- Is that possible to use a Date array?
This is the sample line of code:
Date[] dates = {"12/09/2014","2014/09/09"....};
Date d=new Date();
There are several ways to do this. For example, you can test several known date formats by setting them like this, then using a for-loop to check your date string.
Here's a full implementation from another fellow: http://viralpatel.net/blogs/check-string-is-valid-date-java/
You can also use regular expressions. Here is some sample code to do what you' re asking: http://www.mkyong.com/regular-expressions/how-to-validate-date-with-regular-expression/