From 05b1758ef5f78b1496e77dd00969f3af754afd46 Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期六, 17 十二月 2022 15:01:56 +0800 Subject: [PATCH] 修改时间工具类 --- src/main/java/com/hx/util/DateUtil.java | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hx/util/DateUtil.java b/src/main/java/com/hx/util/DateUtil.java index 3bf51a3..d1e6aab 100644 --- a/src/main/java/com/hx/util/DateUtil.java +++ b/src/main/java/com/hx/util/DateUtil.java @@ -640,7 +640,7 @@ public static String dayToStart(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); - calendar.set(Calendar.HOUR, 0); + calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); @@ -653,7 +653,7 @@ public static String dayToEnd(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); - calendar.set(Calendar.HOUR, 23); + calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); @@ -666,7 +666,7 @@ public static Date dayToEndDate(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); - calendar.set(Calendar.HOUR, 23); + calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); return calendar.getTime(); @@ -722,7 +722,7 @@ public static boolean getFrontMinute(Date date,int num) { Calendar cal = Calendar.getInstance(); cal.setTime(date); - cal.set(Calendar.HOUR, num-1); + cal.set(Calendar.HOUR_OF_DAY, num-1); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); -- Gitblit v1.8.0