public static List<String> getWeekDay(String strDate) {
List<String> list = new ArrayList<String>();//第几周,周几
String nReturn = null;
Calendar c = Calendar.getInstance(); // 实例化一个Calendar对象
c.clear(); // 清空Calendar
c.set(Integer.parseInt(strDate.substring(0, 4)), Integer
.parseInt(strDate.substring(5, 7)) - 1, Integer
.parseInt(strDate.substring(8, 10))); // 设置这个日期的内容
System.out.println("------------" + c.get(Calendar.YEAR) + "年" + (c.get(Calendar.MONTH) + 1) + "月"+(c.get(Calendar.DATE))+"日的天数和周数-------------");
System.out.println("天数:" + c.getActualMaximum(Calendar.DAY_OF_MONTH));
System.out.println("周数:" + c.getActualMaximum(Calendar.WEEK_OF_MONTH));
System.out.println("第几周:"+c.get(Calendar.DAY_OF_WEEK_IN_MONTH));
switch (c.get(Calendar.DAY_OF_WEEK)) {
case 1:
nReturn = "7";
break;
case 2:
nReturn = "1";
break;
case 3:
nReturn = "2";
break;
case 4:
nReturn = "3";
break;
case 5:
nReturn = "4";
break;
case 6:
nReturn = "5";
break;
case 7:
nReturn = "6";
break;
default:
nReturn = null;
break;
}
list.add(String.valueOf(c.get(Calendar.DAY_OF_WEEK_IN_MONTH)));
list.add(nReturn);
return list;
}