Here you can find the source of offsetSecond(Date date, int offset)
public static Date offsetSecond(Date date, int offset)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Date offsetSecond(Date date, int offset) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);// w w w . j ava 2 s . co m calendar.set(Calendar.SECOND, (calendar.get(Calendar.SECOND) + offset)); return calendar.getTime(); } }