Here you can find the source of addSecond(Date date, int number)
public static Date addSecond(Date date, int number)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date addSecond(Date date, int number) { Calendar calendar = getDefaultCalendar(); calendar.setTime(date);//from w ww . ja v a2 s . co m calendar.add(Calendar.SECOND, number); return calendar.getTime(); } /** * get the default calendar * * @return the calendar instance */ public static Calendar getDefaultCalendar() { Calendar calendar = Calendar.getInstance(); calendar.setFirstDayOfWeek(Calendar.MONDAY); return calendar; } }