JS时间戳转时间

Posted on 2019-04-08 14:34  jiaoqing。  阅读(151)  评论(0)    收藏  举报

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;
}

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3