Java code for validating date White slave chatrooms

If date is valid, no exception is thrown and is Valid is set to true in the next statement.

It may be possible to validate date entirely using the regular expression without using Simple Date Format, but it will not be worth the effort.

java code for validating date-58java code for validating date-81

It cannot validate whether the date is actually valid date or not.

Use below given regex patterns If you want to validate date using format different from yyyy-mm-dd.

If above list does not include the format you want to validate, you can easily modify any of the above given regex to suit your needs.

This part will take care of the day part and will not allow anything less than 01 and more than 31.

Here is the example program using above given pattern.

Leave a Reply