js 时间戳转为日期

1 function time(){    //页面时间戳转换成时间
2    $(".time").each(function(){
3         var time = $(this).text();
4         var times = new Date(parseInt(time)*1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");      
5          $(this).text(times);
6     });
7 }

原文地址:https://www.cnblogs.com/isungge/p/4712651.html