Java의 DateTimeFormatter에 문제가 있습니다.DateTimeFormatter 예외
나는 다음과 같은 코드가 있습니다
DateTimeFormatter format = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDateTime startDate = LocalDateTime.now();
LocalDateTime endDate = LocalDateTime.parse(ceremonyDetails.getDate(), format);
System.out.println(ChronoUnit.DAYS.between(startDate, endDate)); format);
형식의 문자열에서 현재와 날짜 사이의 일을 인쇄해야 '/ 09/2016과 같은 1929'을/MM/YYYY를 위해 dd '.
java.time.format.DateTimeParseException: Text '29/09/2016' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to 2016-09-29 of type java.time.format.Parsed] with root cause java.time.DateTimeException: Unable to obtain LocalTime from TemporalAccessor: {},ISO resolved to 2016-09-29 of type java.time.format.Parsed
내가 무엇을 놓치고 :
그러나, 나는이 오류가 무엇입니까?
이 날짜를 추가하는 방법을 알고 싶습니다. 코드에 있습니까? /를 이스케이프 처리해야 할 수도 있습니다. –
@BertVerhees, 제 디버거에서 날짜가 정확히 '29/09/2016 '입니다. – uksz
@ SkaryWombat, 방금 알아 냈습니다. 그게 문제 였어 :) – uksz