我正在尝试解析这个 DateTime:
DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder()
.appendPattern("dd/MM/yyyy hh:mm:ss")
.parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
.parseDefaulting(ChronoField.MILLI_OF_SECOND, 0)
.toFormatter();
String ultimaAtualizacaoTexto = "17/12/2016 01:41:43";
LocalDateTime ultimaAtualizacaoDateTime =
LocalDateTime.parse(ultimaAtualizacaoTexto, dateTimeFormatter);
但我收到此错误:
DateTimeParseException: Text '17/12/2016 01:41:43' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: DateTimeBuilder[fields={MilliOfSecond=0, MinuteOfHour=41, MicroOfSecond=0, NanoOfSecond=0, HourOfAmPm=1, SecondOfMinute=43}, ISO, null, 2016-12-17, null], type org.threeten.bp.format.DateTimeBuilder
我不确定发生了什么......它应该完全有效!
有什么帮助吗?不管怎么说,还是要谢谢你!