import java.text.SimpleDateFormat;
import java.util.*;
public class Dome {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Dome d = new Dome();
Date now = new Date();
SimpleDateFormat myMonth = new SimpleDateFormat("MM");
SimpleDateFormat myYear = new SimpleDateFormat("yyyy");
int month = Integer.parseInt(myMonth.format(now));
int year = Integer.parseInt(myYear.format(now));
System.out.println(d.monthDate(year, month));//本月有多少天
System.out.println(d.monthWeeks());//本月第一天是星期几
}
public String monthWeeks(){
Calendar calendar1 = Calendar.getInstance();
calendar1.set(Calendar.DAY_OF_MONTH, 1);
SimpleDateFormat format = new SimpleDateFormat("E");
return format.format(calendar1.getTime());
}
public int monthDate(int year,int month){
int days = 0;
Calendar calendar=new GregorianCalendar();
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month-1);
days=calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
return days;
}
}