 function diffdate(d1,d2){
	var WNbJours = d2.getTime() - d1.getTime();
	return Math.ceil(WNbJours/(1000*60*60*24));
}

var Date1 = new Date(2010,0,1);
var Date2 = new Date(2011,0,1);
 
alert(diffdate(Date1,Date2) + ' jours');


   function CompareDate() {

       //Note: 00 is month i.e. January

       var dateOne = new Date(2010, 00, 15); //Year, Month, Date

       var dateTwo = new Date(2011, 00, 15); //Year, Month, Date

       if (dateOne > dateTwo) {

            alert("Date One is greather then Date Two.");

        }else {

            alert("Date Two is greather then Date One.");

        }

    }

 

    CompareDate();

//http://javascript.developpez.com/faq/javascript/?page=date