Get Date of past 7days from current in android
<p>I am trying to fetch the date 7days prior to today's date.
I am using SimpleDateFormat to fetch today's date.</p>

<pre><code>SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy");
</code></pre>

<p>Please guide me through this</p>

<p>Updated answer which I found most useful</p>

<pre><code>SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
String currentDateandTime = sdf.format(new Date());
Date cdate=sdf.parse(currentDateandTime);
Calendar now2= Calendar.getInstance();
now2.add(Calendar.DATE, -7);
String beforedate=now2.get(Calendar.DATE)+"/"+(now2.get(Calendar.MONTH) + 1)+"/"+now2.get(Calendar.YEAR);
Date BeforeDate1=sdf.parse(beforedate);
cdate.compareTo(BeforeDate1);
</code></pre>

<p>Thank you for you reply</p>
