//时间戳转时间 function RiQi(sj) { var now = new Date(sj*1000); var year=now.getFullYear(); var month=now.getMonth()+1; var date=now.getDate(); var hour=now.getHours(); var minute=now.getMinutes(); var second=now.getSeconds(); return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second; }
需要转换调用该方法即可:
RiQi(time);
返回的格式是:
2016-10-12 10:10:50