Hi Neil,
That was a good lead. Thanks.

I used this format : 
 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");    

I checked the source of the DateTimePicker class to get the correct format.

So I got it working now but that was a pain.


-----Message d'origine-----
De : Neil Aggarwal [mailto:n...@jammconsulting.com] 
Envoyé : lundi 16 novembre 2009 15:48
À : 'Struts Users Mailing List'
Objet : RE: [Struts 2.1.8] datetimepicker and action: String or Date ??

Fernandes:

> java.text.ParseException: Unparseable date: 
> "2009-11-20T00:00:00+01:00"
>       java.text.DateFormat.parse(Unknown Source)

I have seen this behavior before.

The date format you have is an ISO format, but the Java DateFormat class does 
not parse dates in that format.

I think you will need to manually pull the date out of the request params and 
format it to something DateFormat understands.

Something like this:
        2009-11-20 00:00:00 +0100

Here is a sample code:
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss 
ZZZZZ");
    Date date = dateFormat.parse("2009-11-20 00:00:00 +0100");
    System.out.println(DateFormat.getDateTimeInstance(DateFormat.LONG,
DateFormat.LONG).format(date));

I hope this helps,
        Neil

--
Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net CentOS 5.4 VPS with 
unmetered bandwidth only $25/month!
7 day no risk trial, Google Checkout accepted 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to