|  | @@ -1273,6 +1273,50 @@ public class DateUtil {
 | 
	
		
			
				|  |  |  		return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	public static List<String> getHourList(Date startDate) {
 | 
	
		
			
				|  |  | +		List<String> hourList = new ArrayList<>();
 | 
	
		
			
				|  |  | +		Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  | +		calendar.setTime(startDate);
 | 
	
		
			
				|  |  | +		for (int i = 0; i < 24; i++) {
 | 
	
		
			
				|  |  | +			hourList.add(DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH"));
 | 
	
		
			
				|  |  | +			calendar.add(Calendar.HOUR, 1);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return hourList;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	public static List<String> getDayList(Date startDate, Date endDate) {
 | 
	
		
			
				|  |  | +		List<String> dayList = new ArrayList<>();
 | 
	
		
			
				|  |  | +		Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  | +		calendar.setTime(startDate);
 | 
	
		
			
				|  |  | +		while (!calendar.getTime().after(endDate)) {
 | 
	
		
			
				|  |  | +			dayList.add(DateUtil.format(calendar.getTime(), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | +			calendar.add(Calendar.DAY_OF_MONTH, 1);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return dayList;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	public static List<String> getMonthList(Date startDate, Date endDate) {
 | 
	
		
			
				|  |  | +		List<String> monthList = new ArrayList<>();
 | 
	
		
			
				|  |  | +		Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  | +		calendar.setTime(startDate);
 | 
	
		
			
				|  |  | +		while (!calendar.getTime().after(endDate)) {
 | 
	
		
			
				|  |  | +			monthList.add(DateUtil.format(calendar.getTime(), "yyyy-MM"));
 | 
	
		
			
				|  |  | +			calendar.add(Calendar.MONTH, 1);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return monthList;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	public static List<String> getYearList(Date startDate, Date endDate) {
 | 
	
		
			
				|  |  | +		List<String> yearList = new ArrayList<>();
 | 
	
		
			
				|  |  | +		Calendar calendar = Calendar.getInstance();
 | 
	
		
			
				|  |  | +		calendar.setTime(startDate);
 | 
	
		
			
				|  |  | +		while (!calendar.getTime().after(endDate)) {
 | 
	
		
			
				|  |  | +			yearList.add(DateUtil.format(calendar.getTime(), "yyyy"));
 | 
	
		
			
				|  |  | +			calendar.add(Calendar.YEAR, 1);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return yearList;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * @describe 时间区段辅助类
 | 
	
		
			
				|  |  |  	 * @author Joburgess
 | 
	
	
		
			
				|  | @@ -1520,9 +1564,11 @@ public class DateUtil {
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	public static void main(String[] args) throws ParseException {
 | 
	
		
			
				|  |  | -        Date from = Date.from(LocalDateTime.of(2024, 7, 27, 23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
 | 
	
		
			
				|  |  | -        Date start = Date.from(LocalDateTime.of(2024, 7, 26, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant());
 | 
	
		
			
				|  |  | -        System.out.println(daysBetween(start, from));
 | 
	
		
			
				|  |  | +		List<String> hourList = getMonthList(DateUtil.stringToDate("2024-08-01", DateUtil.DEFAULT_PATTERN),
 | 
	
		
			
				|  |  | +				DateUtil.stringToDate("2025-01-28", DateUtil.DEFAULT_PATTERN));
 | 
	
		
			
				|  |  | +//        Date from = Date.from(LocalDateTime.of(2024, 7, 27, 23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
 | 
	
		
			
				|  |  | +//        Date start = Date.from(LocalDateTime.of(2024, 7, 26, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant());
 | 
	
		
			
				|  |  | +//        System.out.println(daysBetween(start, from));
 | 
	
		
			
				|  |  |  		// DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  |  //		DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |  ////		 System.out.println(daysBetween(df.parse("2017-07-20 10:07:42"), df.parse(df.format(new Date()))));
 |