Calendar cal = new GregorianCalendar(); // creates with today's date
cal.add(1, Calendar.DATE);
Date yesterday = cal.getTime();
sure u dont "add 1" ??
should that be a -1 ??
i just after found these on the web. I'll try the three. Thanks for replying.
Calendar theDate = Calendar.getInstance(); // returns a new locale-specific
calendar set to the current time.
theDate.add(Calendar.DATE, -1);
This converts todays date in milliseconds. Then subtracts the number
of milliseconds in 24 hrs (24*60*60*1000) from it.
Thenit makes a date object by using above calculated milliseconds into constructor.
Date mydate=new Date();
long mymillidate=mydate.getTime();
mymillidate=mymillidate - 24*60*60*1000;
Date previousdate= new Date(mymillidate);