Here you can find the source of yearOffset(Date date, int offset)
public static Date yearOffset(Date date, int offset)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date yearOffset(Date date, int offset) { return offsetDate(date, Calendar.YEAR, offset); }/*from w w w . ja v a 2s. c o m*/ public static Date offsetDate(Date date, int field, int offset) { Calendar calendar = convert(date); calendar.add(field, offset); return calendar.getTime(); } private static Calendar convert(Date date) { Calendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar; } }