Why is this Java Calendar comparison bad?
<p>I'm having an inexplicable problem with the Java Calendar class when I'm trying to compare to dates. I'm trying to compare to Calendars
and determine if their difference is > than 1 day, and do things bases on that difference or not. But it doesn't work.</p>

<p>If I do this with the two dates:</p>

<pre><code>    String currDate = aCurrentUTCCalendar.getTime().toString();
    String localDate = aLocalCalendar.getTime().toString();
</code></pre>

<p>I get these results:</p>

<pre><code>    currDate  = "Thu Jan 06 05:58:00 MST 2010"
    localDate = "Tue Jan 05 00:02:00 MST 2010"
</code></pre>

<p>This is correct.</p>

<p>But if I do this:</p>

<pre><code>    long curr = aCurrentUTCCalendar.getTime().getTime();
    long local = aLocalCalendar.getTime().getTime();
</code></pre>

<p>I get these results: ( in milliseconds since the epoch )</p>

<pre><code>    curr  = -125566110120000 
    local =  1262674920000 
</code></pre>

<p>Since there is only about a 30 hour different between the two, the magnitudes are vastly different, not to mention that annoying negative
sign.</p>

<p>This causes problems if I do this:</p>

<pre><code>long day = 60 * 60 * 24 * 1000; // 86400000 millis, one day

if( local - curr &gt; day )
{
    // do something
}
</code></pre>

<p>What's wrong? Why are the getTime().toString() calls correct, but the getTime().getTime() calls are vastly different?</p>

<p>I'm using jdk 1.6_06 on WinXP. I can't upgrade the JDK for various reasons.</p>
