public static void main(String[] args) {
// TODO Auto-generated method stub
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(calendar.DATE,-1);//把日期往后增加一天.整数往后推,负数往前移动
date=calendar.getTime(); //前一天的时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String day = sdf.format(date);
System.out.print(day);
}
// TODO Auto-generated method stub
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(calendar.DATE,-1);//把日期往后增加一天.整数往后推,负数往前移动
date=calendar.getTime(); //前一天的时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String day = sdf.format(date);
System.out.print(day);
}