You should call SimpleDateFormat.setLenient(false) Then the parse will be strict.
http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html#setLenient(boolean) Maarten On 12/22/06, Trustin Lee <[EMAIL PROTECTED]> wrote:
On 12/21/06, Hieu Phan Thanh <[EMAIL PROTECTED]> wrote: > > Hi Jeroen, I got it now. Thank you so much! Cheers, Hieu Phan. > > > > -----Original Message----- > > From: Jeroen Brattinga [mailto:[EMAIL PROTECTED] > > Sent: Thursday, December 21, 2006 6:38 PM > > To: [email protected] > > Subject: Re: [mina] Java Time validation > > > > You could do a check afterwards on the parsed Date (using the .format > > method) to see if the resulting date-string is equal to the > > original one. Otherwise, you could use a regular expression (Pattern class) as an additional validation rule. BTW you'd better add '[OT]' (means 'off-topic') prefix for this kind of messages. HTH, Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP key fingerprints: * E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E * B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
