SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//获取当前月第一天:
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
setFirstDay(format.format(c.getTime()));
//获取当前月最后一天
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
setLastDay(format.format(ca.getTime()));
//获取当前年第一天:
Calendar c = Calendar.getInstance();
c.add(Calendar.YEAR, 0);
c.set(Calendar.DAY_OF_YEAR,1);//设置为1号,当前日期既为本年第一天
setFirstDay(format.format(c.getTime()));
//获取当前近一年
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.YEAR, -1);
setFirstDay(format.format(calendar.getTime()));
setLastDay(format.format(new Date()));//获取当前日期