一 转为年月日并精确到秒
function renderTime(date){
var da = new Date(parseInt(date.replace("/Date(","").replace(")/","").split("+")[0]));
return da.getFullYear()+"-"+ (da.getMonth()+1)+"-" +da.getDate()+" " +da.getHours()+":"+da.getSeconds()+":"+da.getMinutes();
}
调用函数 <pre name="code" class="javascript">renderTime("1431619200000")
"2015-5-15 0:0:0"
二 转为年月日
function renderTime(date){
var da = new Date(parseInt(date.replace("/Date(","").replace(")/","").split("+")[0]));
return da.getFullYear()+"-"+ (da.getMonth()+1)+"-" +da.getDate()+" " ;
}
调用函数
renderTime("1431532800000")
"2015-5-14 "