Comparison of database date and current date
<p>DB Date is 11-18-2011 03:40:56 and current date is in the same format. 
How to compare? I have implemented the following but it is not giving correct result.
Below is my code.</p>

<pre><code>Calendar calendar = Calendar.getInstance();
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat formatter=   new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
String dateNow = formatter.format(currentDate.getTime());

if(datenow.toString.equals(date2)){

}
</code></pre>
