目录
1. 遍历获取某月的日期集合(返回List<String>)
//遍历获取每月的日期集合
private static List<String> getAllTheDateOftheMonth(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<String> list = new ArrayList();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DATE, 1);
int month = cal.get(Calendar.MONTH);
while(cal.get(Calendar.MONTH) == month){
list.add(sdf.format(cal.getTime()));
cal.add(Calendar.DATE, 1);
}
return list;
}