解决测值查询有重复日期数据问题
parent
826576c3e1
commit
5a4d97234d
|
|
@ -197,13 +197,16 @@ public class DateUtil {
|
|||
public static List<String> getDatesBetween(Date startDate, Date endDate,Boolean isDesc) {
|
||||
List<String> dates = new ArrayList<>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
|
||||
while (calendar.getTime().before(endDate)) {
|
||||
dates.add(convertDateToString(calendar.getTime()));
|
||||
while (startDate.getTime()<=endDate.getTime()){
|
||||
// 把日期添加到集合
|
||||
dates.add(convertDateToString(startDate));
|
||||
// 设置日期
|
||||
calendar.setTime(startDate);
|
||||
//把日期增加一天
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
// 获取增加后的日期
|
||||
startDate=calendar.getTime();
|
||||
}
|
||||
dates.add(convertDateToString(endDate));
|
||||
if(isDesc){
|
||||
return dates.reversed();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue