Java tutorial
//package com.java2s; import android.text.format.Time; public class Main { public static long getNumberOfDaysPassed(long date1, long date2) { Time sThenTime = new Time(); sThenTime.set(date1); int day1 = Time.getJulianDay(date1, sThenTime.gmtoff); sThenTime.set(date2); int day2 = Time.getJulianDay(date2, sThenTime.gmtoff); return Math.abs(day2 - day1); } }