chenjiahe
2023-01-10 58494fbf65b149bfc9cdbef1661c6bb1432bb369
Merge remote-tracking branch 'origin/master'
1个文件已修改
14 ■■■■■ 已修改文件
src/main/java/com/hx/util/DateUtil.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
    }
}