I’m using the following code to get a timestamp in Javascript, but it’s returning a decimal. When I checked the timestamp with an online converter it’s actually correct. I’ve never seen this format before.
var currentTS = new Date().getTime() / 1000;
How can I get a whole number and why is it returning a valid timestamp with a decimal?
Thanks
If the result is not divisible by 1000 you will get a fractional result, its not returning a timestamp, its just returning a number.
If you want to truncate you can;
parseInt(new Date().getTime() / 1000, 10);