我想在一周的开始和当前周的结束之间创建一个间隔。
我有以下代码,借用从this answer:
private LocalDateTime calcNextSunday(LocalDateTime d) {
if (d.getDayOfWeek() > DateTimeConstants.SUNDAY) {
d = d.plusWeeks(1);
}
return d.withDayOfWeek(DateTimeConstants.SUNDAY);
}
private LocalDateTime calcPreviousMonday(LocalDateTime d) {
if (d.getDayOfWeek() < DateTimeConstants.MONDAY) {
d = d.minusWeeks(1);
}
return d.withDayOfWeek(DateTimeConstants.MONDAY);
}
但现在我想让星期一LocalDateTime在00:00:00,星期天LocalDateTime在23:59:59。我该怎么做?