0

I am receiving following ParseException: Unparseable date: "Mai 18, 1987"

I am trying to parse and return it as Date...

the code is:

public class JsonDateDeserializer implements JsonDeserializer<Date> {

  @Override
  public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    try {
        String s = json.getAsJsonPrimitive().getAsString();
        DateFormat format = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH);
        Date date = format.parse(s);
  return date; 
    } catch (ParseException ex) {
        Logger.getLogger(JsonDateDeserializer.class.getName()).log(Level.SEVERE, null, ex);
        Date date = null;
        return date;
    }
} 

}

Thx 4 help in advance

Knuspakeks
  • 129
  • 1
  • 1
  • 11

0 Answers0