$ (function () {
var starttime = transdate ("2014-09-30 15:53:00");
var endtime = transdate ("2014-10-03 15:53:00");
var now = "'" +new Date (). GetTime () + "'";
var nowtime = now.substr (1,10);
if (Nowtime > Endtime) {
$ ('. Meeting_time '). HTML (' show closed ');
}else if (Nowtime < StartTime) {
var day = get_date_different (nowtime,starttime);
$ ('. Meeting_time '). html (' +day+ ' Day ' from the beginning of the show);
}else{
$ ('. Meeting_time '). HTML (' Show 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
JavaScript compares the number of days between two dates