Java 获取 一个月有多少周

Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR, 2013);
        c.set(Calendar.MONTH, (4 - 1));
        c.setFirstDayOfWeek(Calendar.MONDAY); 
        System.out.println( c.get(Calendar.YEAR) + "年" + (c.get(Calendar.MONTH) + 1) + "月");
        System.out.println("天数:" + c.getActualMaximum(Calendar.DAY_OF_MONTH));
        System.out.println("Actual周数:" + c.getActualMaximum(Calendar.WEEK_OF_MONTH));
        System.out.println("Max周数:" + c.getMaximum(Calendar.WEEK_OF_MONTH));

 

你可能感兴趣的:(java)