潘志宝
4 天以前 b8a0affd03b5fa9fa33cd6f870e90394c2df86c7
iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java
@@ -29,8 +29,14 @@
    public static final long SECOND_MILLIS = 1000;
    public static final String FORMAT_YEAR_MONTH_DAY = "yyyy-MM-dd";
    /** 时间格式(yyyy.MM.dd) */
    public final static String DATE_PATTERN_POINT = "yyyy.MM.dd";
    public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss";
    public final static String DATE_TIME_PATTERN_STRING = "yyyyMMddHHmmss";
    public static final String FORMAT_SIMPLE_TIME = "HH:mm";
    /**
     * 日期格式化 日期格式为:yyyy-MM-dd
@@ -194,7 +200,18 @@
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(startDate);
        while (calendar.getTime().compareTo(endDate) <= 0) {
            days.add(DateUtils.format(calendar.getTime(), FORMAT_YEAR_MONTH_DAY));
            days.add(DateUtils.format(calendar.getTime(), FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND));
            calendar.add(Calendar.SECOND, seconds);
        }
        return days;
    }
    public static List<String> getTimeScale(Date startDate, Date endDate, int seconds, String timeFormat) {
        List<String> days = new ArrayList<String>();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(startDate);
        while (calendar.getTime().compareTo(endDate) <= 0) {
            days.add(DateUtils.format(calendar.getTime(), timeFormat));
            calendar.add(Calendar.SECOND, seconds);
        }
        return days;