JSFiddle - React, Tailwind, and code Playground
by alirokni
HTML
<div id="time-stamp">time</div>
JavaScript
function timestamp(epochtime){
this.utcSeconds = epochtime;
this.d = new Date(0); // The 0 there is the key, which sets the date to the epoch
this.d.setUTCSeconds(this.utcSeconds);
return this.d;
}
var mytime = timestamp(1418863946).toString();
$('#time-stamp').text(mytime.substr(4, 11));