Java Timestamp addDays(Timestamp date, int days)

Here you can find the source of addDays(Timestamp date, int days)

Description

add Days

License

Open Source License

Declaration

public static Timestamp addDays(Timestamp date, int days) 

Method Source Code


//package com.java2s;
import java.sql.Timestamp;

import java.util.Calendar;

public class Main {
    public static Timestamp addDays(Timestamp date, int days) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);// w ww.  j ava  2  s  .co m
        cal.add(Calendar.DATE, days); //minus number would decrement the days
        return new Timestamp(cal.getTime().getTime());

    }
}

Related

  1. add(Timestamp target, int addNum, int addKind)
  2. add(Timestamp ts, int field, int amount)
  3. addDate(Timestamp date, String type, int into)
  4. addDays(Timestamp day, int offset)
  5. addDaysToTimestamp(Timestamp start, int days)
  6. addDaysToTimestamp(Timestamp timestamp, int numDays)
  7. addHours(Timestamp date, int numOfHours)