获取当前时间:
Date date2 = new Date();
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");System.out.println(sdf2.format(date2));
获取当前时间往前顺延三个月的时间:
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, 3);
Date date = cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(date));