code to calculate the number of days between two dates
Answer Posted / nikhil
<script language="javascript">
Date.prototype.DaysBetween = function()
{
var intMilDay = 24 * 60 * 60 * 1000;
var intMilDif = arguments[0] - this;
var intDays = Math.floor(intMilDif/intMilDay);
return intDays;
}
var d1 = new Date("06/01/2008");
var d2 = new Date("07/31/2008");
alert(d1.DaysBetween(d2));
var d3=d1.DaysBetween(d2);
document.write(d3);
</script>
| Is This Answer Correct ? | 8 Yes | 6 No |
Post New Answer View All Answers
how to get the User's Time of Day
function to combine two or more arrays
how to pass data between pages using Cookies
code to sorting an array of objects
code to Hide and Show form controls
how to copy form data between different pages
program to show a progress bar
sample code to auto focusing the first field in a form
create Drop-Down Navigation Menus
Code to Block submission of form by pressing Enter Key
how to Scroll a DIV content
code to create a new window
how to pass data between pages using Frames
how to convert between arrays and strings
code to get the coordinates of a Click Event