This example shows how to find the number of minutes between two dates using Java 8 date time api and Joda time. We will set the start date by subtracting 1 day from the current date and the end date to today. Then we will find the number of minutes between the start date and end date which equates to 1440 minutes.
Java 8 Date and Time API
This snippet will find how many minutes are between two dates using java 8 Duration.between and ChronoUnit.MINUTES.between. Both approaches will calculate the amount of time between two temporal objects in the form of minutes.
Joda Time
Using joda, this snippet will calculate number of minutes between two dates using Minutes.minutesBetween.