JS时间戳转时间

时间:2021-01-02 15:26:19

function timestampToTime(timestamp) {
S = timestamp,
T = new Date(1E3 * S),
Format = function(Q){return Q < 10 ? '0' + Q : Q},
Result = Format(T.getFullYear()) + '-' + Format(T.getMonth() + 1) + '-' + Format(T.getDate()) + ' ' + Format(T.getHours()) + ':' + Format(T.getMinutes()) + ':' + Format(T.getSeconds());
return Result;
}