Joke Collection Website - Blessing messages - Looking for a countdown js code, very simple

Looking for a countdown js code, very simple

The logic is as follows:

1. First determine the time difference between the two times. Of course, if the time obtained is a 13-digit timestamp, you need to convert it

2 , Determine if the time is enough for one day to display the number of days, and if it is enough for one hour to display the number of hours

Related code: //Get the time, convert the timestamp, otherwise do not convert

var?mydate1?=? new?Date(parseInt(time1.replace("/Date(",?"").replace(")/",?"")));

var?mydate2?=?new? Date(parseInt(time2.replace("/Date(",?"").replace(")/",?"")));?

//Get the remaining seconds?

var?timerc?=dateDiff(mydate,?'2015/05/19?10:00:00')?/?1000;

function?dateDiff(date1,?date2) ?{

var?dt1?=?new?Date(Date.parse(date1));

var?dt2?=?new?Date(Date.parse(date2) );

try?{

return?Math.round((dt2.getTime()?-?dt1.getTime()));

}

catch?(e)?{

return?e.message;

}

}?

//Loop call countdown function?add()?{?//Add time function

--timerc;?//Time variable decrements by 1

var?day?= ?parseInt(timerc?/?86400);

var?hour?=?parseInt((timerc??86400)?/?3600);

var?min?=? parseInt((timerc??3600)?/?60);

var?sec?=?Number(parseInt(timerc??60?/?10)).toString()? ?Number(parseInt ((timerc??10))).toString();

if?(day?gt;?0)?{?//If it is less than 5 minutes

$( "#day").html(day? ?'day');?//Write the number of days

$("#hour").html(hour? ?'hour');?// Write the number of hours

$("#min").html(min? ?'minute');?//Write the number of minutes

$("#sec") .html(sec? ?'second');?//Write the number of seconds (two digits)

}

else?if?(hour?gt;?0)? {

$("#hour").html(hour? ?'hour');?//Write the number of hours

$("#min").html( min? ?'minutes');?//Write the number of minutes

$("#sec").html(sec? ?'seconds');?//Write the number of seconds (two digits) )

}

else?if?(min?gt;?0)?{

$("#min").html(m

in? ?'minutes');?//Write the number of minutes

$("#sec").html(sec? ?'seconds');?//Write the number of seconds (two digits) )

}

else?if?(sec?=?'00')?{

$("#sec").html(sec ? ?'seconds');?//Write seconds (two digits)

}

else?{

tiao(activity);?return ?true; //Call the function when the time reaches 0

}

setTimeout("add()",?1000);?//Set this function to be executed after 1000 milliseconds

p>

};

Hope to adopt!