OneCompiler

JavaScript program to print Current Time in Seconds

220

Following program shows you how to print current time in seconds.

function getSeconds() {
  var d = new Date();
  var seconds = Math.trunc(d.getTime() / 1000);
  console.log(seconds);
}

getSeconds();

Output:

1626541673

Try it Online here https://onecompiler.com/javascript/3x5qczhbk