Q:

Get date of previous and next week monday from a particular date

I have current week Monday's date with me. Now I would like to find date of previous week Monday if I click on previous and next Monday if I click on next in java. I am looking for a way to add seven days to my date.

A:

You can use calendar class for this:
Here is the example
String dt = "2015-04-13";  // Current monday date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
c.setTime(sdf.parse(dt));
if(next){
  c.add(Calendar.DATE, 7);  // for next Monday
}else{ 
  c.add(Calendar.DATE, -7);  // for previous Monday
}
dt = sdf.format(c.getTime());  // dt is now the new date

