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

between() method does not return expected number of months.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u172
    • Fix Version/s: None
    • Component/s: core-libs
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      mac os

      A DESCRIPTION OF THE PROBLEM :
      I have two dates:

      Start date: "2016-08-31"
      End date: "2016-11-30"

      Its 91 days duration between the above two dates, I expected Java 8 API to return 3 months duration, but actually, Java 8 API only returned 2 months. Its 91 days to return 2 months is reasonable?

      code 1
      long daysBetween = ChronoUnit.MONTHS.between(LocalDate.parse("2016-08-31"),
          LocalDate.parse("2016-11-30"));

      code 2
      Period diff = Period.between(LocalDate.parse("2016-08-31"),
          LocalDate.parse("2016-11-30"));



      REGRESSION. Last worked in version 8u152


      REPRODUCIBILITY :
      This bug can be reproduced always.

      SUPPORT :
      YES

        Attachments

          Activity

            People

            • Assignee:
              psonal Pallavi Sonal
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: