java.time APIs provide many common date and time calculations. To calculate the elapsed time between two LocalDateTime instances you can use:
LocalDateTime start = LocalDateTime.now(); //some time inbetween LocalDateTime end = LocalDateTime.now(); long elapsedMinutes = ChronoUnit.MINUTES.between(start, end);
One Reply to “Elapsed time between two java.time.LocalDateTime instances”