chenjiahe
2023-01-10 58494fbf65b149bfc9cdbef1661c6bb1432bb369
src/main/java/com/hx/util/DateUtil.java
@@ -766,4 +766,18 @@
        month.roll(Calendar.DATE, -1);
        return month.getActualMaximum(Calendar.DATE) - Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
    }
    /**获取当前时间所在周的周一00:00:00*/
    public static Date getMonday(Date date) {
        Calendar calendar = Calendar.getInstance(Locale.CHINA);
        calendar.setTime(date);
        //以周一为首日
        calendar.setFirstDayOfWeek(Calendar.MONDAY);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        //周一
        calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        return calendar.getTime();
    }
}