Answers for "logic to calculate the no of days and months between two dates in java"

1

how to calculate the amount of months between two dates java

LocalDate jamesBirthDay = new LocalDate(1955, 5, 19);
LocalDate now = new LocalDate(2015, 7, 30);
        
int monthsBetween = Months.monthsBetween(jamesBirthDay, now).getMonths();
int yearsBetween = Years.yearsBetween(jamesBirthDay, now).getYears();
        
System.out.println("Month since father of Java born : " 
                    + monthsBetween);
System.out.println("Number of years since father of Java born : " 
                    + yearsBetween);
Posted by: Guest on November-06-2020

Code answers related to "logic to calculate the no of days and months between two dates in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language