I've tried it here in some ways, but it seems to be wrong. An example of what I do:
var data = new Date();
var timestamp = data.getTime() / 1000;
Is this form correct?
I've tried it here in some ways, but it seems to be wrong. An example of what I do:
var data = new Date();
var timestamp = data.getTime() / 1000;
Is this form correct?
Correct. Just missed rounding.
Timestamp in milliseconds:
+new Date() //que é o mesmo que new Date().getTime()
Timestamp in seconds:
Math.floor(+new Date() / 1000) //que o mesmo que Math.floor(new Date().getTime()/1000)