//gets the number of days between two dates
private int daysbetween (date now, date returndate) {Calendar Cnow = calendar.getinstance (); Calendar creturndate = Calendar.getinstance (); Cnow.settime (now); Creturndate.settime (returndate); Settimetomidnight (Cnow); Settimetomidnight (creturndate); Long todayms = Cnow.gettimeinmillis (); Long Returnms = Creturndate.gettimeinmillis (); Long Intervalms = TODAYMS-RETURNMS; Return Millisecondstodays (Intervalms);}
//get the number of minutes between two dates private int Millisecondstodays (Long Intervalms) {return (int) (Intervalms/(86400));}
//gets the number of milliseconds between two dates private void Settimetomidnight (Calendar calendar) {Calendar.set (calendar.hour_of_day, 0); Calendar.set (calendar.minute, 0); Calendar.set (Calendar.second, 0);}
Java gets the number of days between dates