java8获取本月第一天和最后一天
2019-05-22 本文已影响0人
majorty
LocalDate today = LocalDate.now();
//本月的第一天
LocalDate firstday = LocalDate.of(today.getYear(),today.getMonth(),1);
//本月的最后一天
LocalDate lastDay =today.with(TemporalAdjusters.lastDayOfMonth());
System.out.println("本月的第一天" + firstday);
System.out.println("本月的最后一天" + lastDay);