0
JS how to use the new Date() as setInterval()?
Not exactly sure if it’s new Date(), but I know it’s something like that ... new Date(), or setDate(). I’ve seen people recommending using the new Date, (or set date if that’s the right one) instead of setInterval(). They say setInterval and interval aren’t stable... So how would I use the date object to set Interval, still using milliseconds?
7 Antworten
+ 6
//Here is sololearn course on date object but i am not sure what you are concerned about setInterval()
https://www.sololearn.com/learn/JavaScript/1244/
+ 4
Ginfio Oh you wanted to find intervals between 2 times ,
+ 3
Ginfio There is no function like setDate() and new date does not do work you mentioned , maybe it's is setTimeout() and can you please explain your problems more clearly
+ 2
https://code.sololearn.com/WucfuigE2Z58/?ref=app
Sudarshan Rai 👑 , I’m not comcerned about it.
What i was thinking was like...
In this code, I saw that with the setInterval() method, it wasn’t counting 1000 milsec in 1 second.
The milliseconds are way behind than where they should be at.
So, i mentioned that problem one time and someone mentioned to me about using setDate() instead of interval.
.
+ 1
Sudarshan Rai 👑 ahh, now i know what it is.
If you would, look at the first answer on this thread (stackoverflow), that was what i was thinking about.
it’s new Date() btw.
https://stackoverflow.com/questions/1360818/how-to-measure-the-milliseconds-between-mousedown-and-mouseup