code: public static boolean isSameMonth(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.YEAR) == cal2.get(Calendar.YEAR)
                  && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH);
      }
docs: Determines whether the specified date1 is the same month with the specified date2.
  
  @param date1 the specified date1
  @param date2 the specified date2
  @return {@code true} if it is the same month, returns {@code false} otherwise