From a7fa7db6281875687c3e2c90275d4676ac5869c2 Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期三, 04 一月 2023 19:30:51 +0800 Subject: [PATCH] 时间年开始/年结束 --- src/main/java/com/hx/util/DateUtil.java | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hx/util/DateUtil.java b/src/main/java/com/hx/util/DateUtil.java index 64e037f..5bcedbe 100644 --- a/src/main/java/com/hx/util/DateUtil.java +++ b/src/main/java/com/hx/util/DateUtil.java @@ -609,7 +609,7 @@ public static Date getYearStart(Date time) { Calendar calendar = Calendar.getInstance(); calendar.setTime(time); - calendar.set(Calendar.MONTH, 1); + calendar.set(Calendar.MONTH, 0); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); @@ -625,7 +625,7 @@ public static Date getYearEnd(Date time) { Calendar calendar = Calendar.getInstance(); calendar.setTime(time); - calendar.set(Calendar.MONTH, 12); + calendar.set(Calendar.MONTH, 11); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DATE)); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); -- Gitblit v1.8.0