Ryan Sutter wrote:
> 
> I don't know for sure that this specific to Linux Java so my apologies
> in advance.  I am using this code for date validation:
> 
>                 DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
>                 try {
>                     Date theDate = df.parse(theText);
>                     jtf.setText( df.format( theDate )); //??!!
>                 } catch (ParseException pe) {
>                     System.out.println(pe);
>                     jtf.setText("");
>                     jtf.repaint();
>                 }
> 
> This method allows incorrect dates like 13/9/98 without complaining.  My
> testers are complaining though.  :-)  Does anybody know of a better/more
> accurate date validation class out there?  Or a better way to use this
> one?

If I remember right there is something for setting a stricter date
validation.  Just looked it up and its setLenient(boolean) in the
DateFormat class that SimpleDateFormat inherits from.

Let me know if that does the trick!

-- 
Brad Pepers
Linux Canada Inc.            Home of Linux products in Canada!
http://www.linuxcanada.com   Proud supporter of Cyclades, Red
[EMAIL PROTECTED]         Hat, and Caldera.

Reply via email to