how to get yesterday date
<p>I want to get yesterday date or date which is of not today but of the past. I am using this code - </p>

<pre><code>Calendar calendarMessage = Calendar.getInstance();
        Calendar calendarToday = Calendar.getInstance();
        calendarMessage.setTime(date);
        return calendarMessage.get(Calendar.YEAR) == calendarToday.get(Calendar.YEAR) &amp;&amp;
                calendarMessage.get(Calendar.DAY_OF_YEAR) == calendarToday.get(Calendar.DAY_OF_YEAR);
</code></pre>

<p>Can you please help me in this?</p>