function entreDeuxDates(Date1, Date2) { var j = Date1.getDay() ; var m = Date1.getMonth() ; var y = Date1.getYear() ; // Verifie si date1 < date2 // si non, on retourne -1 if(Date2.getYear() < y) { return -1 ; } else if(Date2.getYear() == y) { if(Date2.getMonth() < m) {return -1 ; } else if(Date2.getMonth() == m) { if(Date2.getDay() < j) {return -1 ;} } } var count = 0 ; while(y!=Date2.getYear() && m!=Date2.getMonth() && j!= Date2.getDay()) { j++ ; count++ ; if(j>howManyDaysInThisMonth(m,y)) { j =1 ; m++ ;} if(m>12) { m=1 ; y++ ; } } return count ; }