android date difference code example
Example: how to compare current date and time with another date and time in android
Date date1 = calendar1.getTime();
Date date2 = calendar2.getTime();
if (date1.compareTo(date2) > 0)
{ Log.i("app", "Date1 is after Date2");}
else if (date1.compareTo(date2) < 0)
{ Log.i("app", "Date1 is before Date2");}
else if (date1.compareTo(date2) == 0)
{ Log.i("app", "Date1 is equal to Date2");}