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
code to detect availability of cookies
code to keep a page Out of the browser history
code to detect versions of different browsers like internet explorer, netscape, mozilla, opera etc
code to create a new window
program to bring a window to the front
communication between main window and new windows
how to create a Custom Scrollbar
how to create Expandable and Collapsible Menus
how to create an anonymous function
how to convert between arrays and strings
snippet to prevent submission of form when certain/any validations got failed
how to pass data between pages using Cookies
Create a Menu that can be activated while clicking on Right Mouse button
determine which Element received an Event
program to show a progress bar