|
|
@@ -337,15 +337,13 @@ public class LabBoardApi {
|
|
|
}
|
|
|
|
|
|
public List<Date> dateToWeek(Date mdate) {
|
|
|
- int b = mdate.getDay();
|
|
|
- Date fdate;
|
|
|
- List<Date> list = new ArrayList<Date>();
|
|
|
- Long fTime = mdate.getTime() - b * 24 * 3600000;
|
|
|
- for (int a = 1; a <= 7; a++) {
|
|
|
- fdate = new Date();
|
|
|
- fdate.setTime(fTime + (a * 24 * 3600000));
|
|
|
- list.add(a-1, fdate);
|
|
|
+ List<Date> allDate = new ArrayList <>();
|
|
|
+ for(int i=0;i<7;i++){
|
|
|
+ Calendar calendar = new GregorianCalendar();
|
|
|
+ calendar.setTime(mdate);
|
|
|
+ calendar.add(calendar.DATE,i); //把日期往后增加一天,整数 往后推,负数往前移动
|
|
|
+ allDate.add(calendar.getTime());//这个时间就是日期往后推一天的结果
|
|
|
}
|
|
|
- return list;
|
|
|
+ return allDate;
|
|
|
}
|
|
|
}
|