I am trying to conver unix timestamp to a readable time. I have tried all solutions I can find, none still work. I do not want to use any modules or frameworks. Id appreciate some help converting.(Angular) Please dont link to other questions. ive read them all. Thnk you
var unix = Math.round(+new Date()/1000);
console.log(unix) //works
function secondstotime(unix)
{
var t = new Date(1970,0,1);
t.setSeconds(unix);
var s = t.toTimeString().substr(0,8);
if(unix > 86399)
s = Math.floor((t - Date.parse("1/1/70")) / 3600000) + s.substr(2);
console.log(s);
}
secondstotime();