标签:技术分享 date 前台 new 格式 分享 方法 没有 logs
这个方法网上有好多,不过值得注意的是,你后台传过去的时间戳是不是精确到毫秒的问题
如果精确到毫秒就用下面的这个形式
new Date(parseInt(iteam.time)).toLocaleString().replace(/:\d{1,2}$/,‘ ‘)
如果没有精确到毫秒就用这种形式
new Date(parseInt(iteam.time)*1000).toLocaleString().replace(/:\d{1,2}$/,‘ ‘)
输出的结果是
标签:技术分享 date 前台 new 格式 分享 方法 没有 logs
原文地址:http://www.cnblogs.com/RunningSir/p/7057004.html