Is there any way I can remove characters from an EditText brought from a JSONObject response? Example: 2019-03-06T00:00:00 and only present the chain in this way: 2019-02-10, when making the conversion I throw an exception which is:
java.lang.IllegalArgumentException: Illegal pattern character 'T'
Code:
String yourJsonDateString = jsonResponse.getString(DataManager.Birthdate);
try {
Date yourJsonDate = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSS").parse(yourJsonDateString);
String newDateString = new SimpleDateFormat("yyyy-MM-dd").format(yourJsonDate);
System.out.println(newDateString);
} catch (ParseException e) {
e.printStackTrace();
}