LocalDate使用 2022-03-08 编程 Java 评论 LocalDate跨年快速计算月差1234LocalDate date = LocalDate.now();LocalDate time = LocalDate.now();Integer diff = time.getYear() - date.getYear();Integer month = (time.getMonthValue() - date.getMonthValue()) + (diff *12); LocalDate快速获取当前季度123456LocalDate start = LocalDate.now();int quarter = (start.getMonthValue()-1)/3 + 1;start = start.withMonth(quarter*3 - 2*quarter);System.out.println(quarter);System.out.println(start);