Hello Reader! If you having the timestamp generated by Unix and you want it to be in format of time then you can use the example code below:-
function MakeTime(TimeUnix) {
var d = new Date(TimeUnix);
var h = (d.getHours().toString().length == 1) ? ('0' + d.getHours()) : d.getHours();
var m = (d.getMinutes().toString().length == 1) ? ('0' + d.getMinutes()) : d.getMinutes();
var s = (d.getSeconds().toString().length == 1) ? ('0' + d.getSeconds()) : d.getSeconds();
var time = h + '/' + m + '/' + s;
return time;
}
var Time = MakeTime(1535100000);
console.log(myTime);
0 Comment(s)