I need to get the exact difference in terms of days and months and years between two joda date time. I am using the code below:
DateTime jodaStartTime=new DateTime(startTime);
DateTime jodaEndTime=new DateTime(endTime);
Period period = new Period(jodaStartTime, jodaEndTime);
System.out.print(period.getYears() + " years, ");
System.out.print(period.getMonths() + " months, ");
However, I need to get exact years for example instead of 2 years, I shoud get 2010,2011 or instead of 18 months (covering all months), I need to get the range between 1 to 12.
First, I want to change this code so I can use Java 8 time, so how to do that with Java 8 time?