把二个时间的的年月日分别对比,完全相等就是同一天,代码下:privatestaticbooleanisSameDate(Datedate1,Datedate2){Calendarcal1=Calendar.getInstance();cal1.setTime(date1);Calendarcal2=Calendar.getInstance();cal2.setTime(date2);booleanisSameYear=cal1.get(Calendar.YEAR)==cal2.get(Calendar.YEAR);booleanisSameMonth=isSameYear&&cal1.get(Calendar.MONTH)==cal2.get(Calendar.MONTH);booleanisSameDate=isSameMonth&&cal1.get(Calendar.DAY_OF_MONTH)==cal2.get(Calendar.DAY_OF_MONTH);returnisSameDate;}