转自:http://blog.sina.com.cn/s/blog_9ac333de0102vvcy.html
@SuppressLint("SimpleDateFormat")
public static boolean isSameDay(Date date, Date sameDate) {
if (null == date || null == sameDate) {
return false;
}
Calendar nowCalendar = Calendar.getInstance();
nowCalendar.setTime(sameDate);
Calendar dateCalendar = Calendar.getInstance();
dateCalendar.setTime(date);
if (nowCalendar.get(Calendar.YEAR) == dateCalendar.get(Calendar.YEAR)
&& nowCalendar.get(Calendar.MONTH) == dateCalendar.get(Calendar.MONTH)
&& nowCalendar.get(Calendar.DATE) == dateCalendar.get(Calendar.DATE)) {
return true;
}
// if (date.getYear() == sameDate.getYear() && date.getMonth() == sameDate.getMonth()
// && date.getDate() == sameDate.getDate()) {
// return true;
// }
return false;
}