Javascript convert seconds to a date object
You can pass unix timestamp milliseconds as an argument to the Date constructor:
var secs = 30;
new Date(secs * 1000);
Outputs:
Date 1970-01-01T00:00:30.000Z
You can try like this:
function toDateTime(secs) {
var t = new Date(1970, 0, 1); // Epoch
t.setSeconds(secs);
return t;
}
Info on epoch date.