wrong result in date difference in android
<p>Actually i have performing an date operation in my android app. What i want is to subtract two dates and get the result. But subtraction leads to wrong result whenever i change the time zone to central daylight time.</p>

<p>I have use the following code to find the difference between the two dates.</p>

<pre><code>Long lDateDiff = dtCycleDay.getTime() - m_dtHistory[0].getTime();
lDateDiff = lDateDiff / (1000 * 60 * 60 * 24);
</code></pre>

<p>Here in m_dtHistory[0], the date stored is <strong>Thu Mar 01 00:00:00 CST 2012</strong>. </p>

<p>And in my dtCycleDay variable the date changes from <strong>Thu Mar 01 00:00:00 CST 2012</strong>, <strong>Thu Mar 02 00:00:00 CST 2012, Thu Mar 03 00:00:00 CST 2012</strong>...and so on</p>

<p>Now upto <strong>Thu Mar 11 00:00:00 CST 2012</strong> the subtraction result is fine, but when date changes to <strong>Thu Mar 12 00:00:00 CDT 2012</strong>, the CST changes to CDT and it show wrong subtraction result.</p>

<p>Why this happen and these happen only whent i change the time zone to central Daylight Time or pacific Daylight Time.</p>
