public class Test {
public static void main(String[] args) {
java.util.Calendar rightNow = java.util.Calendar.getInstance();
java.text.SimpleDateFormat sim = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//得到当前时间,+3天
rightNow.add(java.util.Calendar.DAY_OF_MONTH, 3);
//如果是后退几天,就写 -天数 例如:
rightNow.add(java.util.Calendar.DAY_OF_MONTH, -3);
//进行时间转换
String date = sim.format(rightNow.getTime());
System.out.println(date);
}
}