According to this: Get current date/time in seconds
var seconds = new Date().getTime() / 1000;
gives you the time in seconds. But the time given is a decimal number. How can I turn it into whole number?
You do Math.round(new Date().getTime() / 1000)
or a short (and faster version):
new Date().getTime() / 1000 | 0
Using this binary operator will zero the floating number part of your number (and therefore round it down).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With