Java tutorial
import java.time.LocalDate; import java.time.Period; import java.time.temporal.TemporalAdjusters; public class Main { 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()); } }