I’m probably just tired and not thinking clearly, but can someone give a concise way of getting the number of milliseconds passed since the last minute using javascript?
Something like Date.getSeconds(), but that would return milliseconds.
Although I could just do (Date.getSeconds()*1000) + Date.getMilliseconds(), this just seems really awkward and like there has to be a better way.
Thanks!
What about…
Date.nowreturns the current UNIX timestamp in ms.To clarify what’s happening there, the
%operator is called modulo and what it does is that it gives you the remainder from dividing the first number by the other one.An example can be:
…because…
(note the remainder
6)