Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.concurrent.TimeUnit; public class Main { public static long getDaysDiff(long startTime, long endTime) { long msDiff; if (endTime > startTime) { msDiff = endTime - startTime; } else { msDiff = startTime - endTime; } // Log.e(TAG,"diff is "+ daysDiff); return TimeUnit.MILLISECONDS.toDays(msDiff); } }