List of usage examples for java.time.temporal TemporalAdjusters lastDayOfYear
public static TemporalAdjuster lastDayOfYear()
From source file:Main.java
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); }
From source file:Main.java
public static void main(String[] args) { LocalDate today = LocalDate.now(); // Temporal adjusters for adjusting the dates System.out.println("First date of this month= " + today.with(TemporalAdjusters.firstDayOfMonth())); LocalDate lastDayOfYear = today.with(TemporalAdjusters.lastDayOfYear()); System.out.println("Last date of this year= " + lastDayOfYear); Period period = today.until(lastDayOfYear); System.out.println("Period Format= " + period); System.out.println("Months remaining in the year= " + period.getMonths()); }