今天是星期五,2020-06-19

调用nextOrSame和previousOrSame返回都是今天,2020-06-19

调用previous,返回2020-06-12

调用next,返回2020-06-26

 



//上个星期五的日期  如果今天是星期五,则返回上周五的日期
LocalDate previousSaturdayInThisMonth = today.with(TemporalAdjusters.previous(DayOfWeek.FRIDAY));

//(往前包括当天)最近星期五的日期  如果今天是星期五,则返回今天日期
LocalDate previousOrSameSaturdayInThisMonth = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.FRIDAY));

//下个星期五的日期  如果今天是星期五,则返回下周五的日期
LocalDate nextSaturdayInThisMonth = today.with(TemporalAdjusters.next(DayOfWeek.FRIDAY));

//(往后包括当天)最近星期五的日期  如果今天是星期五,则返回今天日期
LocalDate nextOrSameSaturdayInThisMonth = today.with(TemporalAdjusters.nextOrSame(DayOfWeek.FRIDAY));

next和nextOrSame,previous和previousOrSame区别_其他