The result of a separate call to New Date () in JS is: Fri 20:00:00 gmt+0800 time in this format
JS Gets the current timestamp method
JavaScript gets the current timestamp:
The first method:
var time =date.parse (New Date ());
Results: 1463732230000
The second method:
var time = (new Date ()). ValueOf ();
Results: 1463732231455
The third method:
var time=new Date (). GetTime ();
Results: 1463732299085
var ems = document.getElementsByTagName ("em");
var t_time = "2016/05/20 20:00:00";
S_time = new Date (t_time);
S_time = Date.parse (t_time)/1000;
(function settime () {
var n_time = date.parse (New Date ())/1000;
var time = S_time-n_time;
if (time>0) {
var d = parseint (time/86400);
Time = time-d * 86400;
var h = parseint (time/3600);
Time = time-h * 3600;
var m = parseint (TIME/60);
Time = time-m * 60;
var s = time;
ems[3].innerhtml = s;
ems[2].innerhtml = m;
ems[1].innerhtml = h;
ems[0].innerhtml = D;
SetTimeout (settime, 500);
}else {
Alert (' The countdown is over ')
}
})();
New Date () Countdown function