DateFormat df=new SimpleDateFormat("yyyy-MM-dd"); Calendar calendar = Calendar.getInstance(); //获取日历 System.out.println(calendar.get(Calendar.WEEK_OF_YEAR)); //获取是一年的第几周 calendar.set( Calendar.DAY_OF_WEEK, Calendar.MONDAY); //将日历翻到这周的周一 System.out.println(df.format( calendar.getTime())); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); //将日历翻到这周的周日(具体每周是周一开始还是周日,甚至周四周五,都可以设置,方法setFirstDayOfWeek,参数类似) System.out.println(df.format(calendar.getTime())); calendar.add(Calendar.WEEK_OF_YEAR, -2); //使用add进行增减操作,在“一年的第几周”这一属性在当前值的基础上+1,也就是下一周,上一周则是-1 calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);//将日历翻到这周的周一 System.out.println(df.format(calendar.getTime())); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); System.out.println(df.format(calendar.getTime()));