I have a method to parse from an xml in the form of a string, to a Request object. But in the xml the date comes to me like this:
2009-06-12T00: 00: 00 + 02: 00
Then I do not know what format to give the SimpleDateFormat to be able to convert that to Date. That would go inside the parenthesis in:
SimpleDateFormat formatter = new SimpleDateFormat("");
When I execute the method I get the following error:
Unparseable date: "2009-06-12T00:00:00+02:00"
I write the method below:
public Date convertirFecha(String s) throws ParseException{
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date fecha = formatter.parse(s);
return fecha;
}