From 765460125202c993f737dee3a05d54c66ade2499 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Wed, 04 Aug 2021 15:46:23 +0800
Subject: [PATCH] 监测因子趋势图数据格式调整
---
screen-common/src/main/java/com/moral/util/DateUtils.java | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/screen-common/src/main/java/com/moral/util/DateUtils.java b/screen-common/src/main/java/com/moral/util/DateUtils.java
index 8e61079..9281bed 100644
--- a/screen-common/src/main/java/com/moral/util/DateUtils.java
+++ b/screen-common/src/main/java/com/moral/util/DateUtils.java
@@ -1355,4 +1355,37 @@
}
return date;
}
+
+ /*
+ * ������������������������������������
+ * ������time=2021-08-04 ���������������������������������������
+ * time=2021-08 ���������������������������������
+ * */
+ public static List<String> getTimeLag(String time) {
+ List<String> result = new ArrayList<>();
+ int length = time.length();
+ Calendar cal = Calendar.getInstance();
+ String end;
+ String dateFormat;
+ int i;
+ if (length == 10) {//���
+ end = getDateAddDay(time, 1);
+ dateFormat = yyyy_MM_dd_EN;
+ i = Calendar.HOUR_OF_DAY;
+ } else if (length == 7) {//���
+ end = getDateAddMonth(time, 1);
+ dateFormat = yyyy_MM_EN;
+ i = Calendar.DAY_OF_MONTH;
+ } else {//���
+ end = getDateAddYear(time, 1);
+ dateFormat =yyyy;
+ i = Calendar.MONTH;
+ }
+ cal.setTime(getDate(time, dateFormat));
+ for (long d = cal.getTimeInMillis(); d < getDate(end, dateFormat).getTime(); cal.set(i, cal.get(i) + 1), d = cal.getTimeInMillis()) {
+ String format = dateToDateString(new Date(d));
+ result.add(format);
+ }
+ return result;
+ }
}
--
Gitblit v1.8.0