//一年的开始周 java为1.
private static LocalDate parseWeekBegin(int year, int week) {
return LocalDate.parse(year + " " + week,
new DateTimeFormatterBuilder().appendPattern("YYYY w").parseDefaulting(WeekFields.ISO.dayOfWeek(), 1).toFormatter());
}
private static LocalDate parseWeekEnd(LocalDate begin) {
return begin.with(TemporalAdjusters.next(DayOfWeek.SUNDAY));
}
调用:
LocalDate begin = parseWeekBegin(2016,31);
System.out.println(begin);
System.out.println(parseWeekEnd(begin) );
java的日期和时间:http://www.importnew.com/14857.html
Java 8 Date Time API Example Tutorial – LocalDate, Instant, LocalDateTime, Parse and Format
http://www.tuicool.com/articles/a6vq63E