code: public static int getDayAsReadableInt(Calendar calendar) {
          int day = calendar.get(Calendar.DAY_OF_MONTH);
          int month = calendar.get(Calendar.MONTH) + 1;
          int year = calendar.get(Calendar.YEAR);
          return year * 10000 + month * 100 + day;
      }
docs: Readable yyyyMMdd representation of a day, which is also sortable.