I am wandering is there any way to validate date in format dd-mm-yyyy
WITHOUT using any regular expression so that it has to accept date until today's date in java and validation includes checking leap year too ? Accepting input from user and validating in method ?
Asked
Active
Viewed 62 times
0

Kick Buttowski
- 6,709
- 13
- 37
- 58

Lohith
- 1
- 3
-
A regex isn't the right tool to validate a date anyway (do you want to write a regex able to check if there was 29 days in February that year ?). Use a date parser. – Denys Séguret Mar 16 '15 at 17:53
-
How to use date parser ? please help.. I am new to this language – Lohith Mar 16 '15 at 17:57
-
1Look at the linked QA : http://stackoverflow.com/questions/14194290/validating-a-date-in-java – Denys Séguret Mar 16 '15 at 18:10