In my previous task i used this method. In JavaScript, timestamps are usually associated with Unix time. And there are different methods for generating such timestamps.
var timestamp = new Date().getTime();
console.log(timestamp)
// 1660926192826
In the example above, we created a new Date() object and stored it in a timestamp variable. We also attached the getTime() method to the new Date() object using dot notation: new Date().getTime(). This returned the Unix time at that point in milliseconds: 1660926192826. To get the timestamp in seconds, you divide the current timestamp by 1000. That is:
var timestamp = new Date().getTime();
console.log(Math.floor(timestamp / 1000)).