使用TemporalAdjusters
类,您将获得方法firstDayOfNextYear()
,firstDayOfNextMonth()
。如何计算firstDayOfNextWeek()
?
最佳答案
TemporalAdjusters.next(DayOfWeek.MONDAY)
要么
TemporalAdjusters.next(DayOfWeek.SUNDAY)
如果一周的第一天取决于用户区域设置:
TemporalAdjusters.next(WeekFields.of(locale).getFirstDayOfWeek())
(向@Aaron por指出来)