Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 StackOverflow 上搜索了相同的内容,但所有答案都是针对旧版 Java 版本的。我没有使用 Java 8 Data and Time 实用程序找到任何答案。任何人都可以帮助我吗?
我找到了一种使用 LocalDate 和 TemporalAdjuster 的 with() 方法的方法,如下所示:
LocalDate firstSundayOfNextMonth = LocalDate .now() .with(firstDayOfNextMonth()) .with(nextOrSame(DayOfWeek.SUNDAY));