Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8024999

Instant.Parse typo in example

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Version:
      8
    • Resolved In Build:
      b112
    • Verification:
      Verified

      Description

      It seems that Instant.Parse is not working. I am trying to use it but it fails.
      <developer> copied the argument from the javadoc (here http://threeten.github.io/threetenbp/apidocs/org/threeten/bp/Instant.html#parse(java.lang.CharSequence) but it says that is an illegal format.
      JDK Javadoc:
         http://download.java.net/jdk8/docs/api/java/time/Instant.html#parse%28java.lang.CharSequence%29

      Code:

       Instant instant = Instant.parse("2007-12-03T10:15:30:00");

      Exception:

      org.threeten.bp.format.DateTimeParseException: Text '2007-12-03T10:15:30:00' could not be parsed at index 19
          at org.threeten.bp.format.DateTimeFormatter.parseToBuilder(DateTimeFormatter.java:1319)
          at org.threeten.bp.format.DateTimeFormatter.parse(DateTimeFormatter.java:1223)
          at org.threeten.bp.Instant.parse(Instant.java:339)
          at org.modelinglab.ocl.ext.time.classes.InstantDate.testParse(InstantDate.java:19)

      The final ":" should be "." and the Zone is required: "2007-12-03T10:15:30.00Z"

      See Github issue https://github.com/ThreeTen/threeten/issues/337

        Attachments

          Activity

            People

            • Assignee:
              rriggs Roger Riggs
              Reporter:
              rriggs Roger Riggs
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: