Java Second Add addSecond(Date date, int numberOfSecond)

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

Description

add Second

License

Open Source License

Parameter

Parameter Description
date a parameter
numberOfSecond a parameter

Declaration

public static Date addSecond(Date date, int numberOfSecond) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    /**//from  w  w w  .  j  a v  a  2s.c o m
     *
     * @param date
     * @param numberOfSecond
     * @return
     * @deprecated
     */
    public static Date addSecond(Date date, int numberOfSecond) {
        if (numberOfSecond == 0) {
            return date;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.SECOND, numberOfSecond);
        date = cal.getTime();
        return date;
    }
}

Related

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