title: How to find difference between two dates in years months and days in Java?
body: <p>Suppose I have :
  <strong>Employee</strong> model which has <strong><em>startDate</em></strong> as its property variable and <strong>Promotion</strong> model has <strong>promotionDate</strong>. 
  I want to find out for how long employee has  worked until his promotion for which I have to find difference between promotionDate and startDate.
  If I get startDate as <strong>employee.getStartDate()</strong> and promotionDate as <strong>promotion.getPromotionDate</strong>, how can I find difference in years months and days for any dates,</p>
  
  <p>Any help would be really appreciated.</p>
  
  <p><strong>UPDATE : I SOLVED PROBLEM AS BELOW</strong></p>
  
  <pre><code>String startDate = "2018-01-01";
  String promotionDate = "2019-11-08";
  
  LocalDate sdate = LocalDate.parse(startDate);
  LocalDate pdate = LocalDate.parse(promotionDate);
  
  LocalDate ssdate = LocalDate.of(sdate.getYear(), sdate.getMonth(), sdate.getDayOfMonth());
  LocalDate ppdate = LocalDate.of(pdate.getYear(), pdate.getMonth(), pdate.getDayOfMonth());
  
  Period period = Period.between(ssdate, ppdate);
  System.out.println("Difference: " + period.getYears() + " years " 
                                    + period.getMonths() + " months "
                                    + period.getDays() + " days ");
  </code></pre>
  
  <p>Thank you. </p>