Quick (I suppose) question. How to parse string like that "2018-07-22 +3:00"
to OffsetDateTime
(setting time to 0:0:0.0
)?
DateTimeFormatter formatter =cDateTimeFormatter.ofPattern("yyyy-MM-dd xxx");
OffsetDateTime dt = OffsetDateTime.parse("2007-07-21 +00:00", formatter);
java.time.format.DateTimeParseException: Text '2007-07-21 +00:00' could not be parsed: Unable to obtain OffsetDateTime from TemporalAccessor: {OffsetSeconds=0},ISO resolved to 2007-07-21 of type java.time.format.Parsed
DateTimeFormatter
. – Andreas+3:00
, which is an invalid offset since hour is only 1 digit, but your code shows+00:00
with 2-digit hour. Do you need to parse 1-digit hour or not? – Andreas