美文网首页
js格式化时间戳

js格式化时间戳

作者: 小祈祈博客 | 来源:发表于2019-02-12 12:24 被阅读0次

//格式化时间戳

function getLocalTime(nS) {   

  return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');   

}

html+='<time>'+getLocalTime(zhuanti[i].addtime)+'</time>';

相关文章

网友评论

      本文标题:js格式化时间戳

      本文链接:https://www.haomeiwen.com/subject/fpnheqtx.html