I guess this question was asked before. How I can check the validation of date? says: A string "8/4/02" or "09/11/2002" is valid while "08042002" or "02/31/2002" is invalid?
I don't know whether this will help java.text.DateFormat.getDateInstance().parse(dateString) throws a ParseException but i don't know how to use it. Any one can help? Thanks! =)
You use it exactly as you wrote it. dateString is the date you want to check. If the date can not be converted into a valid date, it throws a parse exception. If you want the date to be in a specific format in order to be determined to be valid then you can use the SimpleDateFormat class to define a format.