LocalDate now = LocalDate.now();
LocalDate first = LocalDate.of(now.getYear(), now.getMonthValue(), 1);
LocalDate lastDay = now.with(TemporalAdjusters.lastDayOfMonth());
String firstDayOfMonth = first.format(DateTimeFormatter.ISO_LOCAL_DATE);
String lastDayOfMonth = lastDay.format(DateTimeFormatter.ISO_LOCAL_DATE);
System.out.println(firstDayOfMonth);
System.out.println(lastDayOfMonth);
获取本月第一天和本月最后一天
最新推荐文章于 2024-07-10 15:40:14 发布