Possible Duplicate:
How to get date of last Friday from specified date?
Using java.util.Calendar
(or any other library), is there a way i can find out what the Date of what Month of what Year was "Friday 2 weeks ago"?
Please advise
Possible Duplicate:
How to get date of last Friday from specified date?
Using java.util.Calendar
(or any other library), is there a way i can find out what the Date of what Month of what Year was "Friday 2 weeks ago"?
Please advise
Try this way:
Calendar vCal = Calendar.getInstance();
vCal.add(Calendar.WEEK_OF_YEAR, -2); //two weeks ago
vCal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); //friday
int vDay = vCal.get(Calendar.DAY_OF_MONTH); //day
int vMonth = vCal.get(Calendar.MONTH); //month
int vYear = vCal.get(Calendar.YEAR); //year
Date d = vCal.getTime(); //full date
Good luck.