Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to find number of days between two dates in Java 8 [LocalDate until() & between() Example ]

You can use the LocalDate.between() method to find the number of days between two dates in Java. This method is full proof and takes care of date-time nuisances like leap year and daylight saving time. Before Java 8, it was really difficult to calculate the number of days between two dates in Java. Though old Date and Calendar API provides methods to compare two dates like equals(), before(), and after(), no method can tell the exact difference in days or months between two dates unless you are using the joda-time library. All that is over now. You can now do better date-time arithmetic using Java 8 Date and Time API.


This post first appeared on Javarevisited: Blog About Java Programmin, please read the originial post: here

Share the post

How to find number of days between two dates in Java 8 [LocalDate until() & between() Example ]

×

Subscribe to Javarevisited: Blog About Java Programmin

Get updates delivered right to your inbox!

Thank you for your subscription

×