Yeah, I had a suspicion that this was related but I wasn't sure I wanted
to switch on the time format for the entire site. For instance - some
users might only type in the short date version - some others the long
one. I'm not sure how to address this.

Michael

-----Original Message-----
From: Jeremy Thomerson [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 02, 2008 3:20 PM
To: [email protected]
Subject: Re: java.util.Date model accepting Date incl. time?

It looks like because the DateConverter code uses
DateFormat.getDateInstance(DateFormat.SHORT, locale);, if you dig into
this
method, it uses time style "FULL", which is documented like this:
"3:30:42pm
PST".  Try using that for your date.  If that works, than the problem is
just that it expects a much longer version of the time.

If that's the case, just override the converter for java.util.Date (I
know
you know how to do this ;) and you could put a new DateConverter, and
override this method to return whatever you want.  For instance you
could do
DateFormat.getDateTimeInstance(foo, bar, foo, bar)

    /**
     * @param locale
     * @return Returns the date format.
     */
    public DateFormat getDateFormat(Locale locale)
    {
        if (locale == null)
        {
            locale = Locale.getDefault();
        }

        return DateFormat.getDateInstance(DateFormat.SHORT, locale);
    }


On Mon, Jun 2, 2008 at 4:53 PM, Michael Mehrle <[EMAIL PROTECTED]>
wrote:

> I have a text field that is backed by a java.util.Date model. When
> typing in a simple date (e.g. 4/1/2009) everything is fine. But when I
> type in a date including a time (e.g. 5/23/09 12:00 AM) I get a
> validation error:
>
>
>
> '5/23/09 12:00 AM' is not a valid Date.
>
>
>
> Obviously a date (unlike a Timestamp) should be able to accept a
'full'
> date - how do I fix this?
>
>
>
> Michael
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to