Here you can find the source of addOrMinusSecond(long ti, int i)
public static Date addOrMinusSecond(long ti, int i)
//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 addOrMinusSecond(long ti, int i) { Date rtn = null;/*from w ww. j ava 2 s . co m*/ GregorianCalendar cal = new GregorianCalendar(); Date date = new Date(ti); cal.setTime(date); cal.add(Calendar.SECOND, i); rtn = cal.getTime(); return rtn; } }