public class Test {
public static void main(String[] args) {
Calendar c=Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//今天
String today=df.format(c.getTime());
System.out.println(today);//比如今天是2017-02-08,则将输出2017-02-08
//今天-1天(昨天)
c.add(Calendar.DAY_OF_MONTH, -1);
//将昨天格式化
String yesterday=df.format(c.getTime());
System.out.println(yesterday);//将输出2017-02-07
//昨天+2天(明天)
c.add(Calendar.DAY_OF_MONTH, 2);
//将明天格式化
String tomorrow=df.format(c.getTime());
System.out.println(tomorrow);//将输出2017-02-09
//明天+1天(后天)
c.add(Calendar.DAY_OF_MONTH,1);
//将后天格式化
String nextTomorrow=df.format(c.getTime());
System.out.println(nextTomorrow);//将输出2017-02-10
}
}