📌  相关文章
📜  java 获取两个日期之间的月数 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:09.088000             🧑  作者: Mango

代码示例3
LocalDate currentDay = LocalDate.of(1955, Month.MAY, 19);
        LocalDate desiredDay = LocalDate.now();
        Period age = Period.between(currentDay, desiredDay);
        int years = age.getYears();
        int months = age.getMonths();

        int numberOfMonthsBetweenDates =  months+years*12;