//设置前一天时间
Date nowDate = new Date();
Date lastDate = new Date();
Calendar calendar = Calendar.getInstance();//得到日历
calendar.setTime(nowDate);//把当前时间赋值给日历
calendar.add(Calendar.DAY_OF_MONTH, -1);//设置为前一天
lastDate = calendar.getTime();//得到前一天的时间
int nowMonth = calendar.get(Calendar.MONTH)+1;//得到当前月份
int nowYear = calendar.get(Calendar.YEAR);//得到当前年份
String currentDate = (nowMonth+"/"+nowYear).toString();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String firstStartDate = df.format(nowDate);//当前时间
String firstEndDate = df.format(lastDate);//前一天时间
Date nowDate = new Date();
Date lastDate = new Date();
Calendar calendar = Calendar.getInstance();//得到日历
calendar.setTime(nowDate);//把当前时间赋值给日历
calendar.add(Calendar.DAY_OF_MONTH, -1);//设置为前一天
lastDate = calendar.getTime();//得到前一天的时间
int nowMonth = calendar.get(Calendar.MONTH)+1;//得到当前月份
int nowYear = calendar.get(Calendar.YEAR);//得到当前年份
String currentDate = (nowMonth+"/"+nowYear).toString();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String firstStartDate = df.format(nowDate);//当前时间
String firstEndDate = df.format(lastDate);//前一天时间