9
I 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;
That way is right?
9
I 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;
That way is right?
9
Right. All we had to do was round up.
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)
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
A tip. It can change if the device is at the wrong time. And each place has its time. Here it can be 7:22 there is already 8:22. I advise you to do a Timestamp with a language that the aeu server accepts. So everything is fixed and bug-free
– paulo_tully
My question was about how I could get Unix Timestamp and from what I saw in this old question on the same subject, he did not specify which Timestamp he was looking to get. That answer would not be satisfactory in my case, because in my case I would have to divide by 1000. Javascript as I realized works with milliseconds and in my case I would need to convert to seconds to be able to access an API, this difference left me confused so I asked here.
– wen-dell