I have a JSONObject and an ArrayList from where i get the data, the data date string i get is yyyy/MM/dd 00:00:00, i only want to show the day of the month 1-31, how would i format that string to only show the day ?
I've tried to use SimpleDateFormat, but without any luck, maybe since I'm doing this inside a for loop ?
public void onResponse(String response) {
                        try {
                            //getting the whole json object from the response
                            JSONObject obj = new JSONObject(response);
                            ArrayList<ListModel> ListModelArrayList = new ArrayList<>();
                            JSONArray dataArray = obj.getJSONArray("events");
                            for (int i = 0; i < dataArray.length(); i++) {
                                ListModel List = new ListModel();
                                JSONObject dataobj = dataArray.getJSONObject(i);
                                List.setId(dataobj.getString("id"));
                                List.setInit_date(dataobj.getString("init_date"));
                                List.setEnd_date(dataobj.getString("end_date"));
                                List.setTitle(dataobj.getString("title"));
                                List.setDescription(dataobj.getString("description"));
                                List.setColor_code(dataobj.getString("color_code"));
                                List.setAll_day(dataobj.getString("all_day"));
                                ListModelArrayList.add(List);
                            }
                            for (int j = 0; j < ListModelArrayList.size(); j++) {
                                textViewDate.setText(textViewDate.getText() +
                                        ListModelArrayList.get(j).getInit_Date() + "\n");
                                textViewEvent.setText(textViewEvent.getText() +
                                        ListModelArrayList.get(j).getTitle() + "\n");
                            }
right now i am getting this format 2019-05-17 00:00:00, i want to display 17 only
 
    