We would like to know how to adjust LocalDate to last Day Of Year.
import java.time.LocalDate; import java.time.Month; import java.time.temporal.TemporalAdjusters; //from w w w . j ava 2 s . c o m public class Main { public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25 // last day of 2014 (2014-12-31) LocalDate lastDayOfYear = date.with(TemporalAdjusters.lastDayOfYear()); System.out.println(lastDayOfYear); } }
The code above generates the following result.