Java取得昨天和明天的格式化日期 :
java.text.SimpleDateFormat df=new java.text.SimpleDateFormat( "yyyy-MM-dd ");
java.util.Calendar calendar=java.util.Calendar.getInstance();
calendar.roll(java.util.Calendar.DAY_OF_YEAR,-1);
System.out.println( "昨天: "+df.format(calendar.getTime()));
calendar=java.util.Calendar.getInstance();
System.out.println( "今天: "+df.format(calendar.getTime()));
calendar.roll(java.util.Calendar.DAY_OF_YEAR,1);
System.out.println( "明天: "+df.format(calendar.getTime()));