获取long类型的毫秒值,本周开始时间和本周结束时间:
/**
* @Description:本周的开始时间和结束时间
*/
public static Long[] getStartOrEndDayOfWeek() {
LocalDate today = LocalDate.now();
DayOfWeek week = today.getDayOfWeek();
int value = week.getValue();
LocalDate startDate = today.minusDays(value - 1);
LocalDate endDate = today.plusDays(7 - value);
LocalDateTime start = startDate.atStartOfDay().with(LocalTime.MIN);
LocalDateTime end = endDate.atStartOfDay().with(LocalTime.MAX);
Long startMillis = LDTUtils.getMillis(start);
Long endMillis = LDTUtils.getMillis(end);
return new Long[]{startMillis, endMillis};
}