I want to find the difference between two Calendar objects in number of days if there is date change like If clock ticked from 23:59-0:00 there should be a day
Calendar
In Java 8 and later, we could simply use the java.time classes.
hoursBetween = ChronoUnit.HOURS.between(calendarObj.toInstant(), calendarObj.toInstant()); daysBetween = ChronoUnit.DAYS.between(calendarObj.toInstant(), calendarObj.toInstant());