import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.ChronoUnit;

class Main {
    public static void main(String[] args) {
        LocalDate then = LocalDate.parse("2012-06-22");
        LocalDate now = LocalDate.now();

        Period period = Period.between(then, now);
        System.out.println(period);
        System.out.printf("%d years %d months %d days%n", period.getYears(), period.getMonths(), period.getDays());

        // Examples of subtracting date units
        LocalDate sevenDaysAgo = now.minusDays(7);
        System.out.println(sevenDaysAgo);
        // Alternatively
        sevenDaysAgo = now.minus(7, ChronoUnit.DAYS);
        System.out.println(sevenDaysAgo);
    }
}