Here you can find the source of addSecond(Date date, int second)
Parameter | Description |
---|---|
date | a parameter |
second | a parameter |
public static Date addSecond(Date date, int second)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**/*from w w w .ja v a2 s .co m*/ * Adds given second(s) to the given date * * @param date * @param second * @return */ public static Date addSecond(Date date, int second) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); calendar.add(Calendar.SECOND, second); return calendar.getTime(); } }