Comparing the Current Date with Previous Dates
<p>I am trying to compare two dates. My first date is:</p>

<pre><code>Date previousDate ="Returns a date as 2011-12-09 in a gregorian date"
</code></pre>

<p>and the second date is my "current date", where I am getting my current date as:</p>

<pre><code>SimpleDateFormat format = new SimpleDateFormat(yyyy/mm/dd);
Date date=new Date();
</code></pre>

<p>When I am try to compare the current date with my previous date, I am only able to compare the year (or only the first thing in the pattern).</p>

<pre><code>System.out.println("date"+previousDate.compareto(format(date));
</code></pre>

<p>I am able to get the out put as "1", as it is only comparing the year but not whole date.
Can any of you guys figure out what i am missing.I tried many approaches but couldn't succeed.please let me know if i can work out with this or i need a different solution.</p>

<p>Thanks.</p>
