how to get seconds in timstamps js

JavaScript
var seconds = new Date().getTime() / 1000;
Source

Also in JavaScript: