You can create a SimpleDateFormat and use the parse method.

try {
    Date aDate = new SimpleDateFormat("dd-MM-yyyy").parse(aDateString);
}
catch(java.text.ParseException e) {
    //bad date
}

Regards,
Don

[EMAIL PROTECTED] writes:

<<  create my servlet to let the user input the date and then save it to
database.
 How can I check the date is valid or not?

 For example, the date format is dd-mm-yyyy
 12-05-2001 -> is okay
 12-15-2001 -> is not okay
  >>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to