Próbuję sformatować Instant na datę ldap ISO8601, ale nie powiedzie się na f.format (Instant.now()); :Unsupported field: Year when formatting a instant to Date ISO
String input = "20161012235959.0Z";
DateTimeFormatter f = DateTimeFormatter.ofPattern ("uuuuMMddHHmmss[,S][.S]X");
OffsetDateTime odt = OffsetDateTime.parse (input , f);
Instant instant = odt.toInstant();
f.format(Instant.now());
a błąd jest:
java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: Year
at java.time.Instant.getLong(Instant.java:603)
at java.time.format.DateTimePrintContext.getValue(DateTimePrintContext.java:298)
at java.time.format.DateTimeFormatterBuilder$NumberPrinterParser.format(DateTimeFormatterBuilder.java:2540)
at java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(DateTimeFormatterBuilder.java:2179)
at java.time.format.DateTimeFormatter.formatTo(DateTimeFormatter.java:1746)
at java.time.format.DateTimeFormatter.format(DateTimeFormatter.java:1720)
...
...
Czy próbowałeś z 'yyyy' zamiast' uuuu' we wzorcu? – Rao