Java Timestamp timestampPlusDay(java.sql.Timestamp ts, int iDayPlus)

Here you can find the source of timestampPlusDay(java.sql.Timestamp ts, int iDayPlus)

Description

timestamp Plus Day

License

Open Source License

Declaration

public static long timestampPlusDay(java.sql.Timestamp ts, int iDayPlus) 

Method Source Code

//package com.java2s;

public class Main {
    public static long timestampPlusDay(java.sql.Timestamp ts, int iDayPlus) {
        if (ts == null) {
            return -1;
        }/*w  w  w . j av a 2 s .c om*/
        java.util.Calendar calendar = java.util.Calendar.getInstance();
        calendar.setTimeInMillis(ts.getTime());
        int iDay = calendar.get(calendar.DAY_OF_MONTH);
        calendar.set(calendar.DAY_OF_MONTH, iDay + iDayPlus);
        java.sql.Timestamp tsNew = new java.sql.Timestamp((calendar.getTime()).getTime());
        return tsNew.getTime();
    }
}

Related

  1. timestampIsEquals(Timestamp timestamp1, Timestamp timestamp2)
  2. TimeStampMonthDayYear(Timestamp timestamp)
  3. timestampNow()
  4. TimestampNow()
  5. timestampOf(final ZonedDateTime time)
  6. timestampPlusDay2DDMMYYYY(java.sql.Timestamp ts, int iDayPlus)
  7. trunc(Timestamp dayTime, String trunc)
  8. truncateFractionalSeconds(Timestamp timestamp)
  9. truncateTimestamp(Timestamp timestamp, String period)