I’m getting from the server a Json object with this format "Date": "/Date(1337032800000+0000)/" and I need it to be like “1 April”.
I’m trying to parse it like this, but I always get a "Unparseable date" message:
mDate = jsonArray.getJSONObject(i).getString("Date");
String shortDate = mDate.substring(6, mDate.length()-7);
String format="yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(format);
try {
Date date = sdf.parse(shortDate);
} catch (ParseException e) {
e.printStackTrace();
}
Thanks a lot in advance!
you need to modify your original response something like replace /Date/
now you have
1337032800000which is date in Millisecond.