我如何使用java日历类获取该月下一个第一个星期三的日期。例如:
Today(24/03/2012) the next first Wednesday will be 04/04/2012
On(05/04/2012) the next first Wednesday will be 02/05/2012
thanks.
在Java 8及更高版本中,我们可以使用java.time课程包括LocalDate and TemporalAdjusters,以及DayOfWeek枚举。看Tutorial.
LocalDate firstSundayOfNextMonth = LocalDate
.now()
.with( TemporalAdjusters.firstDayOfNextMonth() )
.with( TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY) );
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)