Java Date add Second
import java.util.Calendar; import java.util.Date; public class Main { public static void main(String[] argv) { Date startDate = new Date(); int addnos = 42; System.out.println(addSecond(startDate, addnos)); }//from w w w.j a va 2 s . c om public static Date addSecond(Date startDate, int addnos) { Calendar cc = Calendar.getInstance(); if (startDate != null) { cc.setTime(startDate); cc.add(Calendar.SECOND, addnos); return cc.getTime(); } else { return null; } } }