Here you can find the source of getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute, int addSecond)
public static Date getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute, int addSecond)
//package com.java2s; import java.util.*; public class Main { public static Date getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute, int addSecond) { Calendar nowdate = new GregorianCalendar(); nowdate.setTime(date);/* ww w. j a v a2 s .c o m*/ nowdate.add(Calendar.YEAR, addYear); nowdate.add(Calendar.MONTH, addMonth); nowdate.add(Calendar.DAY_OF_MONTH, addDay); nowdate.add(Calendar.HOUR_OF_DAY, addHour); nowdate.add(Calendar.MINUTE, addMinute); nowdate.add(Calendar.SECOND, addSecond); return nowdate.getTime(); } public static long getTime() { Date dt = new Date(); return dt.getTime(); } }