Problem to convert date to Brazilian standard using JAXB

1

I'm having trouble converting xml to object using JAXB. The date comes in Sun Jan 30 16:08:23 BRT 18 format, and I want to convert it to the Brazilian format 12-08-2009 16:08:23 .

JAXB conversion class:

public class DateAdapter extends XmlAdapter<String, Date> {

    Locale brasil = new Locale("pt", "BR");
    private final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", brasil);

    @Override
    public String marshal(Date v) throws Exception {
        return dateFormat.format(v);
    }

    @Override
    public Date unmarshal(String v) throws Exception, ParseException {
        return dateFormat.parse(v);
    }

}
    
asked by anonymous 15.02.2016 / 19:50

0 answers