[Solved] Difference between two dates in month in java


 ZoneId defaultZoneId = ZoneId.systemDefault();
           String issueDate1="01/01/2017";  
            Date issueDate2=new SimpleDateFormat("dd/MM/yyyy").parse(issueDate1);
            String dateTo1="31/12/2018";  
            Date dateTo2=new SimpleDateFormat("dd/MM/yyyy").parse(dateTo1);

here year month days can find easily.This giving ans of all question.

            Instant instant = issueDate2.toInstant();
            LocalDate localDatestart = instant.atZone(defaultZoneId).toLocalDate();

            Instant instant1 = dateTo2.toInstant();
            LocalDate localDateend = instant1.atZone(defaultZoneId).toLocalDate().plusDays(1);

        Period diff = Period.between(localDatestart, localDateend);

         System.out.printf("\nDifference is %d years, %d months and %d days old\n\n", 
                        diff.getYears(), diff.getMonths(), diff.getDays());

2

solved Difference between two dates in month in java