获得本周所有日期
private String getOneDayOfWeek(int week, int weekDay){
Calendar c = Calendar.getInstance();
c.add(Calendar.WEEK_OF_YEAR, week);
int preNowWeekDay = c.get(Calendar.DAY_OF_WEEK);
int preSubDays = weekDay - preNowWeekDay;
c.add(Calendar.DAY_OF_WEEK, preSubDays);
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
return sf.format(c.getTime());
}
for (int i = 0; i < 7; i++) {
String x = "date"+i;
x=getOneDayOfWeek(0, i + 2)
Calendar c = Calendar.getInstance();
c.add(Calendar.WEEK_OF_YEAR, week);
int preNowWeekDay = c.get(Calendar.DAY_OF_WEEK);
int preSubDays = weekDay - preNowWeekDay;
c.add(Calendar.DAY_OF_WEEK, preSubDays);
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
return sf.format(c.getTime());
}
for (int i = 0; i < 7; i++) {
String x = "date"+i;
x=getOneDayOfWeek(0, i + 2)
}
//x即为本周7天日期