- //startdate和enddate的格式为:yyyy-MM-dd hh:mm:ss
- //当date1在date2之前时,返回1;当date1在date2之后时,返回-1;相等时,返回0
- function datecompare(date1, date2){
- var strdt1=date1.replace("-","/");
- var strdt2=date2.replace("-","/");
- var d1 = new Date(Date.parse(strdt1));
- var d2 = new Date(Date.parse(strdt2));
- if(d1<d2){
- return 1;
- } else if ( d1>d2 ){
- return -1;
- } else{
- return 0;
- }
- }