Using Unix timestamps in JavaScript is easy. You can use Unix timestamps in JavaScript with the Date() object.
function getTimestampInSeconds () {
return Math.floor(Date.now() / 1000)
}
console.log("Current Unix time is: "+getTimestampInSeconds())
Run this code in JSFiddle.
var date = '2023-01-01T00:00:00.000Z';
var timestamp = Math.floor(new Date(date).valueOf()/1000);
console.log(date+" written as Unix timstamp is: "+timestamp)
Run this code in JSFiddle.
var timestamp = 1691611275
var date = new Date(timestamp * 1000);
console.log("Date: "+date.toLocaleString())
Run this code in JSFiddle.