Java examples for java.time:Year
plus Years to java.util.Date via LocalDate
//package com.java2s; import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; public class Main { public static Date plusYears(Date date, int years) { return localDateToDate(dateToLocalDate(date).plusYears(years)); }//from w w w . j a va 2 s . com public static Date localDateToDate(LocalDate localDate) { return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()) .toInstant()); } public static LocalDate dateToLocalDate(Date date) { return date.toInstant().atZone(ZoneId.systemDefault()) .toLocalDate(); } }