简体   繁体   中英

get the dates of specific day of week

How to be able to know the date of a specific day in next month in java

for example if I enter Friday I need the output to be as following

Friday 9 Jun 2017 Friday 16 Jun 2017 Friday 23 Jun 2017 Friday 30 Jun 2017

LocalDate.of( 2017 , Month.JUNE , 9 )
     .with( TemporalAdjusters.next( DayOfWeek.FRIDAY ) )

You can use java.time.LocalDate and java.time.TemporalAdjusters

java.time API

For Android library to do this code, use the ThreeTenABP project, an adaptation of the ThreeTen-Backport project. See How to use ThreeTenABP .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM