Here you can find the source of addSeconds(Date date, int seconds)
Parameter | Description |
---|---|
date | an instance of a date |
seconds | number of seconds to set |
public static Date addSeconds(Date date, int seconds)
//package com.java2s; //License from project: LGPL import java.util.Calendar; import java.util.Date; public class Main { /**/*w ww .ja v a 2 s . c o m*/ * add seconds to a date * * @param date an instance of a date * @param seconds number of seconds to set * @return an instance of a date with the seconds added */ public static Date addSeconds(Date date, int seconds) { final Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.SECOND, seconds); return c.getTime(); } }