Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how to transform XML Data into HTML

2360


snippet to prevent submission of form when certain/any validations got failed

1904


how to create a Custom Scrollbar

2525


how to pass data between pages using Cookies

2427


code to get the coordinates of a Click Event

2210


code to Hide and Show form controls

2283


how to convert between arrays and strings

2757


function to combine two or more arrays

2129


code to create a new window

2170


maximizing the main window

2059


determine which Element received an Event

2316


code to set the main window's size

2261


code to detect versions of different browsers like internet explorer, netscape, mozilla, opera etc

2149


write a code to generate pseudorandom numbes

2344


advance the focus to next consecutive fields when Enter Key is pressed

2240