Here you can find the source of dateAdd(Timestamp t1, Integer i, int type)
public static Timestamp dateAdd(Timestamp t1, Integer i, int type)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; public class Main { public static Timestamp dateAdd(Timestamp t1, Integer i, int type) { long interval = i * 1000 * 60 * 60 * 24l; Timestamp t = null;//from ww w.j av a 2 s. c om switch (type) { case 1:// hour interval = 1000 * 60 * 60 * i; t = new Timestamp(t1.getTime() + interval); break; case 2:// min interval = 1000 * 60 * i; t = new Timestamp(t1.getTime() + interval); break; case 3:// sec interval = 1000 * i; t = new Timestamp(t1.getTime() + interval); break; case 0: // defaut is day t = new Timestamp(t1.getTime() + interval); break; default: t = t1; } return t; } }