Android Days between two dates

Here’s a two line solution:

long msDiff = Calendar.getInstance().getTimeInMillis() - testCalendar.getTimeInMillis();
long daysDiff = TimeUnit.MILLISECONDS.toDays(msDiff);

In this example it gets the number of days between date “testCalendar” and the current date.

Leave a Comment