function jsGetSjzyts(rysj1,cysj2){ var returnZyts = 0; if( ("" == rysj1) || ("" == cysj2) ) { returnZyts = 0; $('#sjzyts').prop("value", returnZyts); return returnZyts; } else{ var rysjArr = rysj1.split("-"); var rysjYear = rysjArr[0]; var rysjMonth = rysjArr[1]; var rysjDay = rysjArr[2]; var cysjArr = cysj2.split("-"); var cysjYear = cysjArr[0]; var cysjMonth = cysjArr[1]; var cysjDay = cysjArr[2]; if((rysjYear == cysjYear) && (rysjMonth == cysjMonth) && (rysjDay == cysjDay)) { returnZyts = 0; return returnZyts; } else{ var data1 = new Date(rysj1); var data2 = new Date(cysj2); returnZyts = parseInt(Math.abs(data2 - data1) / 1000 / 60 / 60 / 24); return returnZyts; } } }View Code
标签:returnZyts,rysj1,rysjArr,cysjArr,JS,计算,var,相差,cysj2 From: https://www.cnblogs.com/daytoy105/p/16655936.html