code: public static boolean isSameDay(final Date date1, final Date date2) {
          final Calendar cal1 = Calendar.getInstance();
          cal1.setTime(date1);
          final Calendar cal2 = Calendar.getInstance();
          cal2.setTime(date2);
  
          return cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE);
      }
docs: Determines whether the specified date1 is the same day with the specified date2.
  
  @param date1 the specified date1
  @param date2 the specified date2
  @return {@code true} if it is the same day, returns {@code false} otherwise