Calendar calendar = Calendar.getInstance();
//獲得當前月
int month = calendar.get(Calendar.MONTH);
//獲得當前月的上一個月
calendar.set(Calendar.MONTH, month-1);
//獲得當前月的上一個月的第一天
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
Date StartDate=calendar.getTime();
String strStartDate = new SimpleDateFormat("yyyy/MM/dd").format(StartDate);
//獲得當前月的上一個月的最後一天
calendar.set(Calendar.DAY_OF_MONTH,calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
Date EndDate = calendar.getTime();
String strEndDate = new SimpleDateFormat("yyyy/MM/dd").format(EndDate);
//獲得當前月
int month = calendar.get(Calendar.MONTH);
//獲得當前月的上一個月
calendar.set(Calendar.MONTH, month-1);
//獲得當前月的上一個月的第一天
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
Date StartDate=calendar.getTime();
String strStartDate = new SimpleDateFormat("yyyy/MM/dd").format(StartDate);
//獲得當前月的上一個月的最後一天
calendar.set(Calendar.DAY_OF_MONTH,calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
Date EndDate = calendar.getTime();
String strEndDate = new SimpleDateFormat("yyyy/MM/dd").format(EndDate);