From f976feb7ae339c006af150b30802f7edfc8d966f Mon Sep 17 00:00:00 2001 From: cjl <276999030@qq.com> Date: Fri, 13 Oct 2023 09:05:35 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/cjl' into qa --- screen-common/src/main/java/com/moral/util/DateUtils.java | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 1 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 25c78ae..5a51ae9 100644 --- a/screen-common/src/main/java/com/moral/util/DateUtils.java +++ b/screen-common/src/main/java/com/moral/util/DateUtils.java @@ -442,7 +442,7 @@ } /** - * ������������"yyyy-MM-dd HH:mm:ss"������������������������������������������,time2-time1 + * ������������"yyyy-MM-dd"������������������������������������������,time2-time1 * * @param time1 * @param time2 @@ -453,6 +453,20 @@ Date d2 = getDate(time2); return d2.getTime() - d1.getTime(); } + + /** + * ������������"yyyy-MM-dd HH:mm:ss"������������������������������������������,time2-time1 + * + * @param time1 + * @param time2 + * @return + */ + public static long compareDateStrDay(String time1, String time2) { + Date d1 = getDate(time1,DateUtils.yyyy_MM_dd_HH_mm_ss_EN); + Date d2 = getDate(time2,DateUtils.yyyy_MM_dd_HH_mm_ss_EN); + return d2.getTime() - d1.getTime(); + } + /** * ��������������������������������������� @@ -507,6 +521,14 @@ } } + public static boolean isTimeBeforE(Date nows, Date date) { + long hous = nows.getTime() - date.getTime(); + if (hous >= 0) { + return true; + } else { + return false; + } + } /** * ������������������������������������������������������ * @@ -620,6 +642,22 @@ now.setTime(getDate(date, formatStr)); now.add(Calendar.DATE, day); return dateToDateString(now.getTime(), formatStr); + } + + + /** + * ������������������day���������������(formatStr)������������ + * + * @param date + * @param date, + * @param hours + * @return + */ + public static Date getDateAddHour(Date date,int hours) { + Calendar now = Calendar.getInstance(TimeZone.getDefault()); + now.setTime(date); + now.add(Calendar.HOUR_OF_DAY, hours); + return now.getTime(); } /** @@ -1048,6 +1086,14 @@ return getDate(dateToDateString(cal.getTime(), yyyy_MM_dd_EN)); } + public static Date getLastDayOfCurrMonth(Date time) { + Calendar cal = Calendar.getInstance(); + cal.setTime(time); + cal.add(Calendar.MONTH, 1); + cal.set(Calendar.DAY_OF_MONTH, 0); + return getDate(dateToDateString(cal.getTime(), yyyy_MM_dd_EN)); + } + /** * ��������������������������������������������������� * -- Gitblit v1.8.0