This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Date" Watch "Date" New topic
Author

Date

Joey Alencar
Ranch Hand

Joined: Jun 26, 2001
Posts: 43
I'd like to know how can I check if a date is valid.
(Ex: 30-FEB-01; Date is invalid).
Thanks.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
If java.text.DateFormat.getDateInstance().parse(dateString) throws a ParseException, it's not a valid date...
- Peter
Joey Alencar
Ranch Hand

Joined: Jun 26, 2001
Posts: 43
Could you give one example using the format "DD/MM/YYYY"?
Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Date