Java Time: Get max number of weeks for particular year
问题 I only found a solution for Joda Time. My solution works only if the last day is not in the first week: LocalDate.now() // or any other LocalDate .withDayOfMonth(31) .withMonth(12) .get(weekFields.weekOfWeekBasedYear()) So what is the correct way in Java Time (like in Joda Time)? 回答1: This information is available directly using the java.time.* API. The key method is rangeRefinedBy(Temporal) on TemporalField . It allows you to obtain a ValueRange object that provides the minimum and maximum