package chapter5;

import java.time.LocalDate;
import java.time.Period;

public class Example25 {
    public static void main(String[] args) {
        LocalDate birthday = LocalDate.of(2018, 12, 12);
        LocalDate now = LocalDate.of(2020, 11, 13);

        Period period = Period.between(birthday, now);
        System.out.println("时间间隔（年）" + period.getYears());
        System.out.println("时间间隔（月）" + period.getMonths());
        System.out.println("时间间隔（天）" + period.getDays());
    }
}
