Java Second Add addSecond(Date date, int second)

Here you can find the source of addSecond(Date date, int second)

Description

Adds given second(s) to the given date

License

Open Source License

Parameter

Parameter Description
date a parameter
second a parameter

Declaration

public static Date addSecond(Date date, int second) 

Method Source Code

//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();
    }
}

Related

  1. addOrMinusSecond(long ti, int i)
  2. addSecond(Date date, int n)
  3. addSecond(Date date, int number)
  4. addSecond(Date date, int numberOfSecond)
  5. addSecond(Date source, int s)
  6. addSecond(int second)
  7. addSeconds(Date date, int seconds)
  8. addSeconds(Date date, int seconds)