Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find third friday of the Month in Java 8?

I tried searching the question, but no answer explains the Java 8 way of doing this. Can any body help me out with the same?

like image 353
KayV Avatar asked Dec 06 '16 11:12

KayV


1 Answers

The THIRD Friday of December 2016 must be:

LocalDate d = LocalDate.now();
d = d.with(TemporalAdjusters.dayOfWeekInMonth(3, DayOfWeek.FRIDAY));
System.out.println(d); // 2016-12-16
like image 60
Meno Hochschild Avatar answered Nov 14 '22 22:11

Meno Hochschild