I have this code:
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.appendPattern(DateType.DATE_FORMAT)
.appendOffset("+HH:mm", "+00:00")
.toFormatter();
ZonedDateTime.parse("2018-06-09T14:09:30.020+03:00[Europe/Tallinn]", formatter);
DateType.java
:
public class DateType {
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
public static final String DATE_TIME_ZONE_FORMAT = DATE_FORMAT + "XXX";
}
But, I run this code, I have error:
java.time.format.DateTimeParseException: Text '2018-06-09T14:09:30.020+03:00[Europe/Tallinn]' could not be parsed at index 10
As I understand it, this is because of the formatter. What could be wrong?