We're going along this same route but for different reasons... We don't want to force the user to follow a specific format; if we can convert it, we'll take it in any format.
That way our users spend less time learning required formats to use the page and more time getting things done. > -----Original Message----- > From: Mario Ivankovits [mailto:[EMAIL PROTECTED] > Sent: Friday, December 01, 2006 4:29 PM > To: MyFaces Discussion > Subject: Re: inputCalendar validator > > > Hi! > > > > I have a user who loves to enter the date as MM/dd/YY ignoring the > > help text > > > > But the expected is MM/dd/yyyy > > > > So when he enters 12/01/06 …. > > > Might not be much of help, but I implemented a rather complicated > converter ... well not that complicated, just uses tons of simple date > formats ... to allow the user to enter virtually any date. e.g. > mm/dd/yyyy, mm/dd/yy, mm/dd or just dd for the first two > cases I use the > fact that you can have a DateFormat m/d/y and java is smart enough to > parse it right. > > SimpleDateFormat sdf = new SimpleDateFormat("M/d/y", > Locale.US); > System.err.println(sdf.parse("12/01/06")); > System.err.println(sdf.parse("12/01/2006")); > > With some tricky string operations you can create the patterns in a > locale sensitive way. > > Ciao, > Mario > >

