fork(60) download
import java.util.Date;
import java.util.Calendar;

public class Main{

public static void main(String ar[]){
Calendar cal  = Calendar.getInstance();

System.out.println("Today's date= "+cal.getTime());
//subtracting a day
cal.add(Calendar.DATE, -1);
System.out.println("Yesterday's date= "+cal.getTime());

}

}
Success #stdin #stdout 0.04s 246080KB
stdin
Standard input is empty
stdout
Today's date= Wed Jul 11 04:21:43 GMT 2012
Yesterday's date= Tue Jul 10 04:21:43 GMT 2012