查询时间段内所有日期(限foton)
String dataStr = "2019-04"; try { Date date = DateUtils.parseDate(dataStr); Date startTime = DateUtils.getStartTime(DateUtils.DateType.MONTHLY, date, null); Date endTime = DateUtils.getEndTime(DateUtils.DateType.MONTHLY, date); Pair<Date , Date> pair = null; Iterator<Pair<Date , Date>> iterator = DateUtils.getIterator(startTime, endTime, DateType.DAILY, false); while(iterator.hasNext()){ pair = iterator.next(); System.out.println("startTime:" + DateUtils.toString(pair.getKey(),DateUtils.DEFAULT_DATE_TIME_FORMAT) + "____endTime:" + DateUtils.toString(pair.getValue(),DateUtils.DEFAULT_DATE_TIME_FORMAT)); } } catch (ParseException e) { e.printStackTrace(); }