时间戳转换成日期时间
var arr = new Array();
var newTime=new Array();
for(var i=res.data.length-1;i>=0;i--){
arr.push(res.data[i]);
newTime.push(res.data[i].createTime);
}
var now = new Array();
var year = new Array();
var month = new Array();
var day = new Array();
var hour = new Array();
var minute = new Array();
for (var i=0;i<newTime.length;i++){
now.push(new Date(newTime[i]));
year.push(now[i].getFullYear());
month.push(now[i].getMonth()+1);
day.push(now[i].getDate());
hour.push(now[i].getHours());
minute.push(now[i].getMinutes());
}
console.log(arr)
this.setData({
messageList: arr,
timeYear: year,
timeMonth: month,
day: day,
hour,
minute,
})
{{timeYear[index]}}年{{timeMonth[index]}}月{{day[index]}}日{{hour[index]}}:{{minute[index]}}