goto www.codeguru.com - the code is already there for date validation. Hope that helps
 
        Thanks, swami
-----Original Message-----
From: Stefan Dingfelder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 11:10 AM
To: Mario Fernandes (IT Dept. - Langley)
Cc: '[EMAIL PROTECTED]'
Subject: Re: Date validation

Well, Java does not help you here. In fact you will always get the closest possible date ... (It's the same with Microsoft by the way). The only suitable way I know off is to do the checking on your own. You may find a suitable example on the web (I think that ibm's alphaworks team made a MaskedField that also has a validator for dates within)

Regards,
Stefan.

"Mario Fernandes (IT Dept. - Langley)" wrote:

 

Hi

Can you please tell me how to validate if a date entered is a valid date.
FOr ex an invalid date is 02-29-2001(29 feb 2001). But when creating a date
object using the code below no exception is thrown. It instead turns the date into
01-03-2001.

                java.text.SimpleDateFormat s = new
java.text.SimpleDateFormat ("MM-dd-yyyy");
                java.util.Date d = s.parse(Date, new
java.text.ParsePosition(0));
                Timestamp t = new Timestamp(d.getTime());

I would greatly appreciate an early reply.
Many thanks in advance

regards

Mario

Reply via email to