Java Timestamp add(Timestamp target, int addNum, int addKind)

Here you can find the source of add(Timestamp target, int addNum, int addKind)

Description

add

License

Apache License

Declaration

public static Timestamp add(Timestamp target, int addNum, int addKind) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

import java.util.Date;
import java.util.GregorianCalendar;

public class Main {

    public static Timestamp add(Timestamp target, int addNum, int addKind) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(target);//ww  w.jav a  2  s  .  com
        cal.add(addKind, addNum);
        return new Timestamp(new Date(cal.getTimeInMillis()).getTime());
    }
}

Related

  1. add(Timestamp ts, int field, int amount)
  2. addDate(Timestamp date, String type, int into)
  3. addDays(Timestamp date, int days)
  4. addDays(Timestamp day, int offset)