How about today I had a problem with a parseo Date
I'm bringing data from a service so far all good, well I have a field in which brings me a Date
with the following format
2017-01-05 11:11:00
Now this value takes me error in my codigo
, having event as a model and jEvento
as a JSONARRAY
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS", new Locale("es", "pe"));
try {
evento.setFecha_inicio(sdf.parse(jEventos.getJSONObject(i).getString("EVE_FEC_INICIO")+".000000"));
} catch (ParseException e) {
e.printStackTrace();
}
As you will see I have added +".000000"
I do not think it is a good practice, now my question is whether to continue with this code or modify the type of variable in my database.
Maybe someone has a better way to work this. Thanks.