GregorianCalendar cal = new GregorianCalendar();
Date now = new Date();
cal.setTime(now);
cal.setFirstDayOfWeek(GregorianCalendar.MONDAY); // 设置一个星期的第一天为星期1,默认是星期日
SimpleDateFormat dateutil = new SimpleDateFormat("yyyy-MM-dd");
System.out.println("now=" + dateutil.format(cal.getTime())); // 今天
cal.add(GregorianCalendar.DATE,- 1);
System.out.println("now=" + dateutil.format(cal.getTime())); // 昨天
cal.set(GregorianCalendar.DAY_OF_WEEK,GregorianCalendar.MONDAY);
System.out.println("now=" + dateutil.format(cal.getTime())); // 本周1
cal.set(GregorianCalendar.DAY_OF_MONTH,1);
System.out.println("now=" + dateutil.format(cal.getTime())); // 本月1日在此键入内容