public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date nowDate = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(nowDate);
Date updateDate1 = calendar.getTime();
System.out.println("当前时间="+sdf.format(updateDate1));
calendar.set(Calendar.DATE, - 180);
Date updateDate4 = calendar.getTime();
System.out.println("往前推180天的时间="+sdf.format(updateDate4));
//calendar.setTime(updateDate4);
calendar.set(Calendar.DATE, + 3);
Date updateDate5 = calendar.getTime();
System.out.println("180往后推3天的时间="+sdf.format(updateDate5));
}