G
G
gachkydxvbgd2016-06-17 12:47:06
JavaScript
gachkydxvbgd, 2016-06-17 12:47:06

How to find out how much time has passed since the start of the timer?

var timerId = setInterval(function() {
Startfnc();
}, 35000);

how to find out how much time has passed since the start of the timer?

so that the time would be displayed in this format: 2101

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2016-06-17
@gachkydxvbgd

I think the decorator will help you
read the documentation on the topic here
UPDATE
in the node I execute the following js:

var time = new Date();
function Startfnc() {
  console.log('Startfnc exec now');
  time = new Date();
};

var timerId = setInterval(function () {
  Startfnc();
}, 10000);

var logging = setInterval(function () {
  var localdate = new Date();
  console.log('last coll: ' + (localdate - time));
}, 2000);

Result:
>node test
last coll: 2002
last coll: 4119
last coll: 6129
last coll: 8131
Startfnc exec now
last coll: 130
last coll: 2131
last coll: 4133
last coll: 6134
last coll: 8134
Startfnc exec now
last coll: 132
last coll: 2132
last coll: 4133
last coll: 6135
last coll: 8136
Startfnc exec now

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question