Java Timestamp addTime(java.sql.Timestamp start, int year, int month, int day)

Here you can find the source of addTime(java.sql.Timestamp start, int year, int month, int day)

Description

Adds the time.

License

Apache License

Parameter

Parameter Description
start the start
year the year
month the month
day the day

Return

the java.sql. timestamp

Declaration

public static java.sql.Timestamp addTime(java.sql.Timestamp start, int year, int month, int day) 

Method Source Code

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

public class Main {
    /**/* ww w  . j a va 2s  .c  om*/
     * Adds the time.
     *
     * @param start the start
     * @param year  the year
     * @param month the month
     * @param day   the day
     * @return the java.sql. timestamp
     */
    public static java.sql.Timestamp addTime(java.sql.Timestamp start, int year, int month, int day) {
        return new java.sql.Timestamp(start.getTime() + year * 365 * 24 * 60 * 60 * 1000
                + month * 30 * 24 * 60 * 60 * 1000 + day * 24 * 60 * 60 * 1000);
    }
}

Related

  1. addHours(Timestamp date, int numOfHours)
  2. addHoursToTimestamp(Timestamp start, int hours)
  3. addMilli(Timestamp nowDate, int period)
  4. addMonth(java.sql.Timestamp src, int val)
  5. addMonths(Timestamp refDate, int nrOfMonthsToAdd)
  6. adjustTimestamp(Timestamp stamp, int adjType, int adjQuantity, TimeZone timeZone, Locale locale)
  7. adjustTimestamp(Timestamp stamp, Integer adjType, Integer adjQuantity)
  8. adjustTimestamp(Timestamp timestamp, String timezone, int gmtOffset)
  9. afterMinutes(Timestamp date, long min)