From d6464955dc20cb527f7be02ac8631c1effb1768a Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 23 十二月 2024 16:12:11 +0800 Subject: [PATCH] 计算点查询问题修复 --- iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java b/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java index bb8f25c..39f8a7e 100644 --- a/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java +++ b/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/util/date/DateUtils.java @@ -36,6 +36,8 @@ public final static String DATE_TIME_PATTERN_STRING = "yyyyMMddHHmmss"; + public static final String FORMAT_SIMPLE_TIME = "HH:mm"; + /** * 日期格式化 日期格式为:yyyy-MM-dd * @param date 日期 @@ -204,6 +206,17 @@ 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; + } + /** * 对日期的【秒】进行加/减 * -- Gitblit v1.9.3