Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two three textboxes
1.should display from date
2.this display todate
3.this display the number
count no.of days between fromdate and todate
how it is possible
Posted

1 solution

Try this

XML
<script type="text/javascript">
    function getnoofdays(){
                var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds

                var firstDate = new Date(2008,01,12);
                var secondDate = new Date(2008,01,22);

                var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay)));
                Textbox3.Value=diffDays;
               // alert(diffDays);
                }
    </script>



mark it answer if this is your solution


Thanks
ashish
 
Share this answer
 
v2
Comments
amperayani 7-Jul-12 8:39am    
i want those values to be display 3rd textbox
i.e.. 1st textbox date and 2nd textbox date should be minus and that value should display in 3rd textbox how would i get this please help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900