用Calendar类,它里面有方法,具体不说了啊

解决方案 »

  1.   

    public static void xxx() throws Exception{
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    String str_today="2007-12-06";
    Date date=df.parse(str_today);

    Calendar cal  = Calendar.getInstance();
    cal.setFirstDayOfWeek(Calendar.MONDAY);//注意这里
    cal.setTime(date);

    cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
    System.out.println(df.format(cal.getTime()));//周一
    cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    System.out.println(df.format(cal.getTime()));//周日
    }