프로그래밍/JAVA

[Java] java.time.format.DateTimeParseException: Text 'yyyyMMdd' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to yyyy-MM-dd of type java.time.format.Parsed

Gooding 2023. 3. 29. 21:28
728x90
반응형

java.time.format.DateTimeParseException 해결 방법

 

Unable to obtain LocalDateTime from TemporalAccessor 에 주목해보면 에러를 쉽게 해결할 수 있음

LocalDateTime.parse("2023-03-29", DateTimeFormatter.ofPattern("yyyy-MM-dd"));

 

 

LocalDateTime을 LocalDate 타입으로 바꿔주자

LocalDate.parse("2023-03-29", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
반응형