统计当月天数
Date date= new Date();
Calendar calendar= Calendar.getInstance();
calendar.setTime(date);
int maxDay= calendar.getActualMaximum(5);
遍历当月星期
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM");
SimpleDateFormat dfs= new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df= new SimpleDateFormat("yyyyMM");
SimpleDateFormat dfDay =new SimpleDateFormat("EEEE");
Date date= new Date();
String month= sdf.format(date);
String weekMonth= month;
Calendar calendar= Calendar.getInstance();
calendar.setTime(date);
int maxDay= calendar.getActualMaximum(5);
String rq= df.format(date);
for(int i=1;i<=maxDay;i++) {
StringBuffer s1 = null;
StringBuffer s2 = null;
StringBuffer s3 = null;
StringBuffer s4 = null;
StringBuffer s5 = null;
s1 = new StringBuffer(rq);
String sz = String.valueOf(i);
if (i < 10) {
s3 = new StringBuffer("0");
s4 = new StringBuffer(sz);
s2 = s3.append(s4);
s5 = new StringBuffer("-0").append(s4);
} else {
s2 = new StringBuffer(sz);
s5 = new StringBuffer("-").append(s2);
}
Date week = dfs.parse(weekMonth + s5);
String weeks = dfDay.format(week);
System.out.println("week::"+weeks);
}
先写这两个,后面遇到在总结