Validating date format in java
The 1st approach was 4 times faster than the 2nd approach, and 8 times faster than the 3rd approach. I already had this approach tested in the "Date checking/testing and performance testing" section.See the self contained date checker and performance tester main class at the bottom. It does not cover invalid dates like 001-0002-00003.Would you like to answer one of these unanswered questions instead?
we have specified the date format as “MM/dd/yyyy” that’s why only the date passed in this format is shown as valid in the output.
Please check this post for a good pattern : Regex to validate date format dd/mm/yyyy This solution take a Simple Date Format to check if it is valid or not.