Android的几个月

时间:2010-12-28 14:07:48

标签: java android

我怎样才能得到特定月份和特定年份的所有日子..

1 个答案:

答案 0 :(得分:3)

Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH,someMonth);//month starts from 0
cal.set(Calendar.YEAR,someYear);
int noOfDayInMonthyear = cal.getActualMaximum(Calendar.DAY_OF_MONTH); //either 28,29,30,31

并从1迭代到noOfDayInMonthyear

相关问题