Java Timestamp Now getCurrentTimeStamp(int offsetDays)

Here you can find the source of getCurrentTimeStamp(int offsetDays)

Description

get Current Time Stamp

License

Open Source License

Declaration

public static Timestamp getCurrentTimeStamp(int offsetDays) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    public static Timestamp getCurrentTimeStamp(int offsetDays) {
        Timestamp ts = new Timestamp(System.currentTimeMillis());
        Calendar calendar = GregorianCalendar.getInstance();
        calendar.setTime(ts);/*from   ww  w  .  jav  a  2s  .co m*/
        calendar.add(Calendar.DAY_OF_YEAR, offsetDays);
        ts.setTime(calendar.getTime().getTime());
        return new Timestamp(calendar.getTime().getTime());
    }
}

Related

  1. getCurrentTimeStamp()
  2. getCurrentTimestamp()
  3. getCurrentTimestamp()
  4. getCurrentTimeStamp()
  5. getCurrentTimeStamp()
  6. getCurrentTimeStamp(String format)
  7. getCurrentTimestampAsString()
  8. getNowTimeStamp()
  9. getTimeStamp()