Here you can find the source of getTimestampDiff(int n)
public static Timestamp getTimestampDiff(int n)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Timestamp getTimestampDiff(int n) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date d = new Date(); Date dayDiff = new Date(d.getTime() + n * 24 * 3600 * 1000L); String time = df.format(dayDiff); return Timestamp.valueOf(time); }/*w ww . j av a 2 s. c om*/ }