【发布时间】:2026-01-11 11:45:02
【问题描述】:
我有这段代码:
public static final String DATE_PATTERN = "yyyy-MM-dd";
OffsetDateTime.parse(startTime, DateTimeFormatter.ofPattern(DateFormat.DATE_PATTERN)
但是我在解析的时候出现这个错误:
java.time.format.DateTimeParseException: Text '2019-07-10' could not be parsed: Unable to obtain OffsetDateTime from TemporalAccessor: {},ISO resolved to 2019-07-10 of type java.time.format.Parsed
【问题讨论】:
-
对于
OffSetDateTime,我认为您需要偏移量。这更像是LocalDate
标签: java date datetime java-8 format