javascript - Countdown inverted -


anyone can me? example, want countdown timer inverted, example:

i insert date , hour in javascript or mysql (doesn't matter) , count ..

example: inserted: 01/07/2015

today counter show: 1day 1hour 19min

if don't want use jquery can this:

var starttime = +new date("07/01/2015"); // m/d/y gets timestamp in ms    var second = 1000;  var minute = second * 60;  var hour = minute * 60;  var day = hour * 24;    var element = document.getelementbyid('timer'); // target element timer    function countup() {    // time between , start date    var time = date.now() - starttime;      // days passed since start    var days = math.floor(time / day);    time -= days * day;      // hours passed    var hours = math.floor(time / hour);    time -= hours * hour;      // minutes passed    var minutes = math.floor(time / minute);      // update element    element.innerhtml = days + 'day ' + hours + 'hour ' + minutes + 'min';      settimeout(countup, minute);  };    countup();
<span id="timer"></span>


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -