Javascript compares the days between two dates
$ (Function (){
Var starttime = transdate ("15:53:00 ");
Var endtime = transdate ("15:53:00 ");
Var now = "'" + new Date (). getTime () + "'";
Var nowtime = now. substr (1, 10 );
If (nowtime> endtime ){
('.Meeting_time'{.html ('exhibition ended ');
} Else if (nowtime <starttime ){
Var day = get_date_different (nowtime, starttime );
('.Meeting_time'0000.html ('from the start of the exhibition, '+ day + 'day ');
} Else {
('.Meeting_time'0000.html ('exhibition in progress ');
}
});
Function get _ (www.111cn.net) date_different (date_1, date_2 ){
Var days = date_2-date_1;
Var time = parseInt (days/(60*60*24 ));
Return time;
}
Function transdate (endTime ){
Var date = new Date ();
Date. setFullYear (endTime. substring (0, 4 ));
Date. setMonth (endTime. substring (5, 7)-1 );
Date. setDate (endTime. substring (8, 10 ));
Date. setHours (endTime. substring (11,13 ));
Date. setMinutes (endTime. substring (14,16 ));
Date. setSeconds (endTime. substring (17,19 ));
Return Date. parse (date)/1000;
} From: http://www.111cn.net/wy/js-ajax/66437.htm