Amira Elsayed Ismail
Amira Elsayed Ismail

Reputation: 9394

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

Upvotes: 0

Views: 55

Answers (1)

fg78nc
fg78nc

Reputation: 5232

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.

Upvotes: 2

Related Questions