Hello,
I'm trying to use the new java.time api that comes with Java 8 (I already know joda-time).
I'm using the latest build B124.
I've a String "01/08/2012_00:00:01", I know that the time ref. is UTC, and I want to convert it to an 'Instant';
I tried:
DateTimeFormatter FORMAT_DT = DateTimeFormatter.ofPattern("dd/MM/yyyy_HH:mm:ss").withZone(ZoneOffset.UTC);
Instant instant = Instant.from(FORMAT_DT.parse("01/08/2012_00:00:01"));But it fails with following error:
java.time.DateTimeException: Unable to obtain Instant from TemporalAccessor: {},ISO resolved to 2012-08-01T00:00:01 of type java.time.format.Parsed
at java.time.Instant.from(Unknown Source)I don't understand what's wrong with my code, and I can't figure out how I should proceed to convert the String to an Instant ...
Any suggestion welcome,
Best regards,
Bernard.