I get a DataHora String like this:
2017-10-11 10: 39: 04.217923
I remove this number after the period, and I use LocalDateTime.parse()
:
private final String PATTERN_DATA_HORA = "dd/MM/yyyy HH:mm:ss";
[...]
Movimentacao movimentacao = new Movimentacao();
StringTokenizer stringTokenizer = new StringTokenizer(movimentos.getJSONObject(i).get("dt_andamento_pa").toString());
movimentacao.setData(LocalDateTime.parse(stringTokenizer.nextToken("."), DateTimeFormatter.ofPattern(PATTERN_DATA_HORA)).atOffset(ZoneOffset.UTC));
I have the following parse error:
Text
2017-10-11 10:39:04
could not be parsed at index 2.
Note: I have seen similar forums in similar forums, but the error continues. What to do?