Here you can find the source of getCurrentTimeStamp(int offsetDays)
public static Timestamp getCurrentTimeStamp(int offsetDays)
//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()); } }