javascript - Calculate between two dates to percent -


i want calculate between 2 dates difference percent. not date, hours needed scale. example:

22-08-2017 09:00 start date, 30.09.2017 22:00 finish date, 

the today date 01.09.2017. when system today, application show me "%47 percent completed" want this.

the javascript date object can used in arithmetic expressions. convert milliseconds.

var start, finish, midpoint, percent, elapsed;  start = new date(2017, 8, 22, 9); finish = new date(2017, 9, 30, 22); midpoint = new date(2017, 8, 29, 12);  elapsed = midpoint - start; percent = (elapsed / (finish - start)) * 100;  console.log('elapsed', elapsed, ' ms', percent, ' % complete'); 

https://jsfiddle.net/fwb3g4nc/1/


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -