【发布时间】:2016-05-19 19:14:59
【问题描述】:
当我这样做时
String datum = "20130419233512";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss").withZone(ZoneId.of("Europe/Berlin"));
OffsetDateTime datetime = OffsetDateTime.parse(datum, formatter);
我得到以下异常:
java.time.format.DateTimeParseException: Text '20130419233512' could not be parsed:
Unable to obtain OffsetDateTime from TemporalAccessor: {InstantSeconds=1366407312},ISO,Europe/Berlin resolved
to 2013-04-19T23:35:12 of type java.time.format.Parsed
如何解析我的日期时间字符串,以便将其解释为始终来自“欧洲/柏林”时区?
【问题讨论】:
-
我在这里详细讨论了
java.time背后的理论:stackoverflow.com/a/56508200/145989