一、格式化的字符串
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
System.out.println(df.format(new Date()));// new Date()为获取当前系统时间
二、得到可变化日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DATE,7); //calendar.add(Calendar.DATE,-7);
date =calendar.getTime(); //得到7天后的日期