When I do this
String datum = "20130419233512";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss").withZone(ZoneId.of("Europe/Berlin"));
OffsetDateTime datetime = OffsetDateTime.parse(datum, formatter);
I get the following exception:
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
How can I parse my datetime string so that it is interpreted as always being from the timezone "Europe/Berlin" ?
java.time
at length here: stackoverflow.com/a/56508200/145989 – Ondra Žižka