SEE ANSWER FROM @Basil Bourque for most up to date answer
For example, if I have a \"Date\" variable \"date1\" with a value of (dd/mm/yyy) 03/07/2011, which is a S
If you are willing to use Joda time it will be very easy.
An example:
DateTime toDay=new DateTime();
DateTime dateOfPreviousWeek=toDay.minusDays(7);
Another:
DateTime toDay = new DateTime(2011, 7, 1, 0, 0, 0, 0);
DateTime dateOfPreviousWeek = toDay.minusDays(7);
You can get java.util.Date
from DateTime as:
Date javaDate=jodaDateTime.toDate();