timestamp javasctipt unix a partir da data
Math.round(new Date().getTime() / 1000).toString()
Busy Bee
Math.round(new Date().getTime() / 1000).toString()
const unixTime = 1210981217;
const date = new Date(unixTime*1000);
console.log(date.toLocaleDateString("en-US"));
//expected: "5/16/2008"
var s = new Date(1504095567183).toLocaleDateString("en-US")
// expected output "8/30/2017"
console.log(s);
var timestamp = 1607110465663
var date = new Date(timestamp);
console.log(date.getTime())
console.log(date)
javascriptCopyvar timestamp = 1607110465663
var date = new Date(timestamp);
console.log("Date: "+date.getDate()+
"/"+(date.getMonth()+1)+
"/"+date.getFullYear()+
" "+date.getHours()+
":"+date.getMinutes()+
":"+date.getSeconds());
const d = new Date( timestamp );
date = d.getHours() + ":" + d.getMinutes() + ", " + d.toDateString();
console.log( date );
// e.g. 17:44, Tue Jun 16 2020