I format a ZonedDateTime then attempt to parse it and get the following exception.
public static void main(String[] args){
String timeStr=ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT);
System.out.println(timeStr);
ZonedDateTime.parse(timeStr,DateTimeFormatter.ISO_INSTANT);
}
resulting exception
Exception in thread "main" java.time.format.DateTimeParseException: Text '2016-10-05T21:38:26.191Z' could not be parsed: Unable to obtain ZonedDateTime from TemporalAccessor: {MicroOfSecond=191000, MilliOfSecond=191, InstantSeconds=1475703506, NanoOfSecond=191000000},ISO of type java.time.format.Parsed
at java.time.format.DateTimeFormatter.createError(DateTimeFormatter.java:1920)
I need to be able to convert time to and from that string format. What is the best way to do that?