| | |
| | | int monthSix = months / 6;//6个月维度数量 |
| | | int restMonth = months % 6;//剩余的整月 |
| | | int monthDays = dateCompare.getMonthDays();//不满一个月的天数 |
| | | Date date = new Date(); |
| | | List<Date> list = new ArrayList<>(); |
| | | for (int i = 0; i < monthSix; i++) { |
| | | list.add(DateUtil.addMonthToDate(date,i*6)); |
| | | list.add(DateUtil.addMonthToDate(startDate,i*6)); |
| | | } |
| | | if(restMonth>0 || monthDays>0){ |
| | | list.add(DateUtil.addDaysToDate(date,monthSix)); |
| | | list.add(DateUtil.addDaysToDate(startDate,monthSix)); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | int monthThree = months / 3;//3个月维度数量 |
| | | int restMonth = months % 3;//剩余的整月 |
| | | int monthDays = dateCompare.getMonthDays();//不满一个月的天数 |
| | | Date date = new Date(); |
| | | List<Date> list = new ArrayList<>(); |
| | | for (int i = 0; i < monthThree; i++) { |
| | | list.add(DateUtil.addMonthToDate(date,i*3)); |
| | | list.add(DateUtil.addMonthToDate(startDate,i*3)); |
| | | } |
| | | if(restMonth>0 || monthDays>0){ |
| | | list.add(DateUtil.addDaysToDate(date,monthThree)); |
| | | list.add(DateUtil.addDaysToDate(startDate,monthThree)); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | DateCompare dateCompare = DateCompare.monthYearCompare(startDate, endDate ); |
| | | int years = dateCompare.getYear(); |
| | | int yeardays = dateCompare.getYearDays(); |
| | | Date date = new Date(); |
| | | List<Date> list = new ArrayList<>(); |
| | | for (int i = 0; i < years; i++) { |
| | | list.add(DateUtil.addYearToDate(date,i)); |
| | | list.add(DateUtil.addYearToDate(startDate,i)); |
| | | } |
| | | if(yeardays>0){ |
| | | list.add(DateUtil.addYearToDate(date,years)); |
| | | list.add(DateUtil.addYearToDate(startDate,years)); |
| | | } |
| | | return list; |
| | | } |