Good morning;
I am trying to convert a String
containing the following string 2017-11-29
, to an object Date
with the format dd/MM/yyyy
, however it throws an error when trying to do parse()
.
java.text.ParseException: Unparseable date: "2017-11-29"
DateFormat formateador = new SimpleDateFormat("dd/MM/yyyy");
String f = "2017-11-29";
try {
Date fechaPeriodo = formateador.parse(f); //El error se genera aqui
String periodo = formateador.format(fechaPeriodo);
fechaPeriodo = formateador.parse(periodo);
} catch (ParseException e) {
e.printStackTrace();
}