java.time.format.DateTimeParseException: Text '2016-09-18T12:17:21:000Z' could not be parsed at index 19

Stack Overflow | maksim2020 | 3 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Java 8 date/time: instant, could not be parsed at index 19

    Stack Overflow | 3 months ago | maksim2020
    java.time.format.DateTimeParseException: Text '2016-09-18T12:17:21:000Z' could not be parsed at index 19
  2. 0

    GitHub comment 7#258703944

    GitHub | 6 months ago | soc
    java.time.format.DateTimeParseException: Text '2007-12-03T10:15:30' could not be parsed at index 19
  3. 0

    FULL PRODUCT VERSION : java version "1.8.0_102" Java(TM) SE Runtime Environment (build 1.8.0_102-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode) ADDITIONAL OS VERSION INFORMATION : Mac OS X 10.11.6 A DESCRIPTION OF THE PROBLEM : The `java.time.Instant` class fails to parse input with a comma such as "2016-01-02T12:34:56,7Z". The java.time classes handle ISO 8601 formats by default when parsing or generating Strings that represent date-time values. The ISO 8601 standard accepts a decimal mark of either a COMMA or a FULL STOP (period, dot), with a preference for the COMMA. Source: the Wikipedia page for ISO 8601. https://en.wikipedia.org/wiki/ISO_8601 So I would expect this to work: String inputDot = "2016-01-02T12:34:56.7Z"; Instant instantDot = Instant.parse ( inputDot ); …as well as this one… String inputComma = "2016-01-02T12:34:56,7Z"; Instant instantComma = Instant.parse ( inputComma ); The first one with a dot does indeed succeed, but the second one with a comma fails with a `DateTimeParseException`. Exception in thread "main" java.time.format.DateTimeParseException: Text '2016-01-02T12:34:56,7Z' could not be parsed at index 19 at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) at java.time.Instant.parse(Instant.java:395) at com.example.javatimestuff.App4.doIt(App4.java:92) at com.example.javatimestuff.App4.main(App4.java:61) STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Run this code: String inputComma = "2016-01-02T12:34:56,7Z"; Instant instantComma = Instant.parse ( inputComma ); EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Expect an `Instant` object to be instantiated. ACTUAL - java.time.format.DateTimeParseException ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "main" java.time.format.DateTimeParseException: Text '2016-01-02T12:34:56,7Z' could not be parsed at index 19 at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851) at java.time.Instant.parse(Instant.java:395) at com.example.javatimestuff.App4.doIt(App4.java:92) at com.example.javatimestuff.App4.main(App4.java:61) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- String inputComma = "2016-01-02T12:34:56,7Z"; Instant instantComma = Instant.parse ( inputComma ); ---------- END SOURCE ----------

    JDK Bug System | 9 months ago | Webbug Group
    java.time.format.DateTimeParseException: Text '2016-01-02T12:34:56,7Z' could not be parsed at index 19
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.time.format.DateTimeParseException: Text '20161010202413.8Z' could not be parsed at index 0

    Stack Overflow | 7 months ago | daydreamer
    java.time.format.DateTimeParseException: Text '20161010202413.8Z' could not be parsed at index 0

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.time.format.DateTimeParseException

      Text '2016-09-18T12:17:21:000Z' could not be parsed at index 19

      at java.time.format.DateTimeFormatter.parseResolved0()
    2. Java RT
      Instant.parse
      1. java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
      2. java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
      3. java.time.Instant.parse(Instant.java:395)
      3 frames
    3. core.domain.converters
      TestDateTime.main
      1. core.domain.converters.TestDateTime.main(TestDateTime.java:10)
      1 frame