Here you can find the source of addTime(Date date, Date addTime)
public static Date addTime(Date date, Date addTime)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date addTime(Date date, Date addTime) { Calendar calendar = Calendar.getInstance(); calendar.setTime(addTime);/*from ww w. j av a2s . c om*/ int addHour = calendar.get(Calendar.HOUR); int addMinute = calendar.get(Calendar.MINUTE); int addSecond = calendar.get(Calendar.SECOND); int addMillisecond = calendar.get(Calendar.MILLISECOND); calendar.setTime(date); calendar.add(Calendar.MILLISECOND, addMillisecond); calendar.add(Calendar.SECOND, addSecond); calendar.add(Calendar.MINUTE, addMinute); calendar.add(Calendar.HOUR, addHour); return calendar.getTime(); } }