code: public static Date getLastDayFromLastMonth(Date d) {
          Calendar cal = Calendar.getInstance();
          cal.setTime(d);        
          cal.add(Calendar.MONTH, -1);
          cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
          cal.set(Calendar.HOUR_OF_DAY, 23);
          cal.set(Calendar.MINUTE, 59);
          cal.set(Calendar.SECOND, 59);
          cal.set(Calendar.MILLISECOND, 999);
          return cal.getTime();
      }
docs: Get last date from last month
  @param d date
  @return last date from last month