loops - Javascript how to start script on exact time -


  1. script start on exact time (ex: 2015:06:15:00:00)
  2. if on time, alert hello every 1 second.

setinterval(function () {alert("hello")}, 1000);

could please me how make on up?

  1. i'd use gettime object in js
  2. i believe have time set right in jsfiddle

    var d = new date(); var year = d.getfullyear(); // month 0 = january | month 11 = december | changed vallues +one var month = d.getmonth() + 1; var day = d.getdate(); var hour = d.gethours(); var minute = d.getminutes(); var second = d.getseconds();  var overall = year.tostring() + month.tostring() + day.tostring() + hour.tostring() + minute.tostring() + second.tostring();  alert(overall);  var checkdate =  function () { if(overall==="20156150000") {     setinterval(function(){ alert("hello"); }, 1000);     }; };  window.setinterval(checkdate(), 1000); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -