Date Calculation using Js
<p>I am using JS to calculate my date diffrence but i did not get the rounded value please guide me.
Formula used to find the Approximate amount</p>

<pre><code>value1 = todate - fromdate;
value2 = value1 / 30;
value3 = value2 * 5000;
</code></pre>

<p>for this i am using the  following code</p>

<pre><code> var preioddiff = parseInt(todate ) - parseInt(fromdate);
 var dividen = preioddiff / 30;
 var totappamt =  dividen * parseInt(5000);
</code></pre>

<p>but it does not give the correct answer </p>

<p>for example From Date  is 04012011 and to date is 04022011 if i subtract the value using the parseInt(todate ) - parseInt(fromdate); it return the value <code>13303380</code> instead of 0001000</p>
