0

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

Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175

1 Answers1

2
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.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
fg78nc
  • 4,774
  • 3
  • 19
  • 32