public class Test {
public static void main(String[] args)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss");
Date date=new Date();//取时间
("当前时间:"+(date));
Calendar calendar=new GregorianCalendar();
(date);
(,1);//把日期往后增加一天.整数往后推,负数往前移动
date=();
//这个时间就是日期往后推一天的结果
("后一天时间:"+(date));
Calendar calendarBefore=new GregorianCalendar();
(date);
(,-1);//把日期往前推一天.整数往后推,负数往前移动
date=();
//这个时间就是日期往前推一天的结果
("前一天时间:"+(date));
}
}