Java Second Add addOrMinusSecond(long ti, int i)

Here you can find the source of addOrMinusSecond(long ti, int i)

Description

add Or Minus Second

License

Open Source License

Declaration

public static Date addOrMinusSecond(long ti, int i) 

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 {

    public static Date addOrMinusSecond(long ti, int i) {
        Date rtn = null;/*from  w  ww. j  ava  2  s  . co  m*/
        GregorianCalendar cal = new GregorianCalendar();
        Date date = new Date(ti);
        cal.setTime(date);
        cal.add(Calendar.SECOND, i);
        rtn = cal.getTime();
        return rtn;
    }
}

Related

  1. addSecond(Date date, int n)
  2. addSecond(Date date, int number)
  3. addSecond(Date date, int numberOfSecond)
  4. addSecond(Date date, int second)